Submission #32502


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <cstdio>
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
#define reps(i,f,n) for(int i=(f); i<=(n); ++i)
#define outl(x) cout<< (x) << '\n'
#define inside(x,y,W,H) (x>=0 && y>=0 && x<W && y<H)
constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, 1, 0, -1};
constexpr char hello[] = "helloworld";
int H, W;
char mas[128][128];
bool find(int y, int x, int dir)
{
int i = 0;
while (i < 10 && inside(x,y,W,H)) {
if (mas[y][x] != hello[i]) {
return (false);
}
++i;
x += dx[dir];
y += dy[dir];
}
return (i == 10);
}
int main()
{
cin.tie(0), ios::sync_with_stdio(false);
cin >> H >> W;
rep(i, H)
cin >> mas[i];
bool found = false;
rep(i, H) {
rep(j, W) {
if (mas[i][j] == 'h') {
rep(k, 4) {
if (found = find(i, j, k)) goto QUIT;
}
}
}
}
QUIT:
outl( found? "Homono is Criminal" : "NA" );
return (0);
}

ステータス

項目 データ
問題 0055 - Hello world Extreme
ユーザー名 Arumakan_ei1727
投稿日時 2018-04-06 19:39:30
言語 C++17
状態 Accepted
得点 1
ソースコード長 1051 Byte
最大実行時間 22 ms
最大メモリ使用量 588 KB

セット

セット 得点 Cases
1 ALL 1 / 1 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
sample1_in.txt AC 20 ms 480 KB
1
sample2_in.txt AC 22 ms 436 KB
1
sample3_in.txt AC 15 ms 516 KB
1
sample4_in.txt AC 17 ms 588 KB
1
sample5_in.txt AC 20 ms 524 KB
1