# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
51175 |
2018-06-17T04:27:24 Z |
노영훈(#1283, Diuven) |
None (JOI16_ho_t4) |
C++11 |
|
161 ms |
19580 KB |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int MX=100010, inf=2e9;
int n, k;
char S[MX];
map<pii, bool> B, C;
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n>>k;
assert(k==1);
cin>>(S+1);
B[pii(0,0)]=true;
for(int i=1, x=0, y=0; i<=n; i++){
if(S[i]=='N') y++;
if(S[i]=='S') y--;
if(S[i]=='E') x++;
if(S[i]=='W') x--;
B[pii(x,y)]=true;
}
int ans=0;
C[pii(0,0)]=true;
if(B[pii(0,0)] && B[pii(1,0)] && B[pii(0,1)] && B[pii(1,1)]) ans++;
for(int i=1, x=0, y=0; i<=n; i++){
if(S[i]=='N') y++;
if(S[i]=='S') y--;
if(S[i]=='E') x++;
if(S[i]=='W') x--;
if(!C[pii(x,y)] && B[pii(x,y)] && B[pii(x+1,y)] && B[pii(x,y+1)] && B[pii(x+1,y+1)]) ans++;
C[pii(x,y)]=true;
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
3 ms |
460 KB |
Output is correct |
6 |
Correct |
2 ms |
576 KB |
Output is correct |
7 |
Correct |
2 ms |
576 KB |
Output is correct |
8 |
Correct |
3 ms |
576 KB |
Output is correct |
9 |
Correct |
2 ms |
576 KB |
Output is correct |
10 |
Correct |
2 ms |
700 KB |
Output is correct |
11 |
Correct |
2 ms |
700 KB |
Output is correct |
12 |
Correct |
2 ms |
700 KB |
Output is correct |
13 |
Correct |
2 ms |
700 KB |
Output is correct |
14 |
Correct |
2 ms |
700 KB |
Output is correct |
15 |
Correct |
2 ms |
700 KB |
Output is correct |
16 |
Correct |
2 ms |
700 KB |
Output is correct |
17 |
Correct |
2 ms |
700 KB |
Output is correct |
18 |
Correct |
2 ms |
700 KB |
Output is correct |
19 |
Correct |
2 ms |
700 KB |
Output is correct |
20 |
Correct |
2 ms |
700 KB |
Output is correct |
21 |
Correct |
2 ms |
700 KB |
Output is correct |
22 |
Correct |
2 ms |
700 KB |
Output is correct |
23 |
Correct |
2 ms |
700 KB |
Output is correct |
24 |
Correct |
2 ms |
700 KB |
Output is correct |
25 |
Correct |
2 ms |
700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
3 ms |
460 KB |
Output is correct |
6 |
Correct |
2 ms |
576 KB |
Output is correct |
7 |
Correct |
2 ms |
576 KB |
Output is correct |
8 |
Correct |
3 ms |
576 KB |
Output is correct |
9 |
Correct |
2 ms |
576 KB |
Output is correct |
10 |
Correct |
2 ms |
700 KB |
Output is correct |
11 |
Correct |
2 ms |
700 KB |
Output is correct |
12 |
Correct |
2 ms |
700 KB |
Output is correct |
13 |
Correct |
2 ms |
700 KB |
Output is correct |
14 |
Correct |
2 ms |
700 KB |
Output is correct |
15 |
Correct |
2 ms |
700 KB |
Output is correct |
16 |
Correct |
2 ms |
700 KB |
Output is correct |
17 |
Correct |
2 ms |
700 KB |
Output is correct |
18 |
Correct |
2 ms |
700 KB |
Output is correct |
19 |
Correct |
2 ms |
700 KB |
Output is correct |
20 |
Correct |
2 ms |
700 KB |
Output is correct |
21 |
Correct |
2 ms |
700 KB |
Output is correct |
22 |
Correct |
2 ms |
700 KB |
Output is correct |
23 |
Correct |
2 ms |
700 KB |
Output is correct |
24 |
Correct |
2 ms |
700 KB |
Output is correct |
25 |
Correct |
2 ms |
700 KB |
Output is correct |
26 |
Correct |
3 ms |
700 KB |
Output is correct |
27 |
Correct |
4 ms |
752 KB |
Output is correct |
28 |
Correct |
8 ms |
1132 KB |
Output is correct |
29 |
Correct |
22 ms |
2540 KB |
Output is correct |
30 |
Correct |
40 ms |
2684 KB |
Output is correct |
31 |
Correct |
131 ms |
16392 KB |
Output is correct |
32 |
Correct |
43 ms |
16392 KB |
Output is correct |
33 |
Correct |
44 ms |
16392 KB |
Output is correct |
34 |
Correct |
45 ms |
16392 KB |
Output is correct |
35 |
Correct |
43 ms |
16392 KB |
Output is correct |
36 |
Correct |
41 ms |
16392 KB |
Output is correct |
37 |
Correct |
44 ms |
16392 KB |
Output is correct |
38 |
Correct |
42 ms |
16392 KB |
Output is correct |
39 |
Correct |
44 ms |
16392 KB |
Output is correct |
40 |
Correct |
41 ms |
16392 KB |
Output is correct |
41 |
Correct |
37 ms |
16392 KB |
Output is correct |
42 |
Correct |
37 ms |
16392 KB |
Output is correct |
43 |
Correct |
46 ms |
16392 KB |
Output is correct |
44 |
Correct |
44 ms |
16392 KB |
Output is correct |
45 |
Correct |
38 ms |
16392 KB |
Output is correct |
46 |
Correct |
95 ms |
16392 KB |
Output is correct |
47 |
Correct |
98 ms |
16392 KB |
Output is correct |
48 |
Correct |
144 ms |
19580 KB |
Output is correct |
49 |
Correct |
147 ms |
19580 KB |
Output is correct |
50 |
Correct |
161 ms |
19580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
3 ms |
460 KB |
Output is correct |
6 |
Correct |
2 ms |
576 KB |
Output is correct |
7 |
Correct |
2 ms |
576 KB |
Output is correct |
8 |
Correct |
3 ms |
576 KB |
Output is correct |
9 |
Correct |
2 ms |
576 KB |
Output is correct |
10 |
Correct |
2 ms |
700 KB |
Output is correct |
11 |
Correct |
2 ms |
700 KB |
Output is correct |
12 |
Correct |
2 ms |
700 KB |
Output is correct |
13 |
Correct |
2 ms |
700 KB |
Output is correct |
14 |
Correct |
2 ms |
700 KB |
Output is correct |
15 |
Correct |
2 ms |
700 KB |
Output is correct |
16 |
Correct |
2 ms |
700 KB |
Output is correct |
17 |
Correct |
2 ms |
700 KB |
Output is correct |
18 |
Correct |
2 ms |
700 KB |
Output is correct |
19 |
Correct |
2 ms |
700 KB |
Output is correct |
20 |
Correct |
2 ms |
700 KB |
Output is correct |
21 |
Correct |
2 ms |
700 KB |
Output is correct |
22 |
Correct |
2 ms |
700 KB |
Output is correct |
23 |
Correct |
2 ms |
700 KB |
Output is correct |
24 |
Correct |
2 ms |
700 KB |
Output is correct |
25 |
Correct |
2 ms |
700 KB |
Output is correct |
26 |
Runtime error |
2 ms |
19580 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
3 ms |
460 KB |
Output is correct |
6 |
Correct |
2 ms |
576 KB |
Output is correct |
7 |
Correct |
2 ms |
576 KB |
Output is correct |
8 |
Correct |
3 ms |
576 KB |
Output is correct |
9 |
Correct |
2 ms |
576 KB |
Output is correct |
10 |
Correct |
2 ms |
700 KB |
Output is correct |
11 |
Correct |
2 ms |
700 KB |
Output is correct |
12 |
Correct |
2 ms |
700 KB |
Output is correct |
13 |
Correct |
2 ms |
700 KB |
Output is correct |
14 |
Correct |
2 ms |
700 KB |
Output is correct |
15 |
Correct |
2 ms |
700 KB |
Output is correct |
16 |
Correct |
2 ms |
700 KB |
Output is correct |
17 |
Correct |
2 ms |
700 KB |
Output is correct |
18 |
Correct |
2 ms |
700 KB |
Output is correct |
19 |
Correct |
2 ms |
700 KB |
Output is correct |
20 |
Correct |
2 ms |
700 KB |
Output is correct |
21 |
Correct |
2 ms |
700 KB |
Output is correct |
22 |
Correct |
2 ms |
700 KB |
Output is correct |
23 |
Correct |
2 ms |
700 KB |
Output is correct |
24 |
Correct |
2 ms |
700 KB |
Output is correct |
25 |
Correct |
2 ms |
700 KB |
Output is correct |
26 |
Correct |
3 ms |
700 KB |
Output is correct |
27 |
Correct |
4 ms |
752 KB |
Output is correct |
28 |
Correct |
8 ms |
1132 KB |
Output is correct |
29 |
Correct |
22 ms |
2540 KB |
Output is correct |
30 |
Correct |
40 ms |
2684 KB |
Output is correct |
31 |
Correct |
131 ms |
16392 KB |
Output is correct |
32 |
Correct |
43 ms |
16392 KB |
Output is correct |
33 |
Correct |
44 ms |
16392 KB |
Output is correct |
34 |
Correct |
45 ms |
16392 KB |
Output is correct |
35 |
Correct |
43 ms |
16392 KB |
Output is correct |
36 |
Correct |
41 ms |
16392 KB |
Output is correct |
37 |
Correct |
44 ms |
16392 KB |
Output is correct |
38 |
Correct |
42 ms |
16392 KB |
Output is correct |
39 |
Correct |
44 ms |
16392 KB |
Output is correct |
40 |
Correct |
41 ms |
16392 KB |
Output is correct |
41 |
Correct |
37 ms |
16392 KB |
Output is correct |
42 |
Correct |
37 ms |
16392 KB |
Output is correct |
43 |
Correct |
46 ms |
16392 KB |
Output is correct |
44 |
Correct |
44 ms |
16392 KB |
Output is correct |
45 |
Correct |
38 ms |
16392 KB |
Output is correct |
46 |
Correct |
95 ms |
16392 KB |
Output is correct |
47 |
Correct |
98 ms |
16392 KB |
Output is correct |
48 |
Correct |
144 ms |
19580 KB |
Output is correct |
49 |
Correct |
147 ms |
19580 KB |
Output is correct |
50 |
Correct |
161 ms |
19580 KB |
Output is correct |
51 |
Runtime error |
2 ms |
19580 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
52 |
Halted |
0 ms |
0 KB |
- |