# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
594070 |
2022-07-12T04:38:00 Z |
반딧불(#8432) |
None (JOI16_ho_t4) |
C++17 |
|
48 ms |
5452 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int xx[]={0, 1, 0, -1}, yy[]={1, 0, -1, 0};
int n, k;
int arr[100002];
set<pair<int, int> > st;
int main(){
scanf("%d %d", &n, &k);
for(int i=1; i<=n; i++){
char c;
scanf(" %c", &c);
if(c == 'N') arr[i] = 0;
else if(c == 'E') arr[i] = 1;
else if(c == 'S') arr[i] = 2;
else arr[i] = 3;
}
st.insert(make_pair(0, 0));
int x = 0, y = 0;
for(int i=1; i<=n; i++){
x += xx[arr[i]], y += yy[arr[i]];
st.insert(make_pair(x, y));
}
int ans = 0;
for(auto p: st){
if(st.find(make_pair(p.first, p.second+1)) == st.end() || st.find(make_pair(p.first+1, p.second)) == st.end() ||
st.find(make_pair(p.first+1, p.second+1)) == st.end()) continue;
ans++;
}
printf("%d", ans);
}
Compilation message
2016_ho_t4.cpp: In function 'int main()':
2016_ho_t4.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
14 | scanf("%d %d", &n, &k);
| ~~~~~^~~~~~~~~~~~~~~~~
2016_ho_t4.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
17 | scanf(" %c", &c);
| ~~~~~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
312 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
308 KB |
Output is correct |
13 |
Correct |
0 ms |
308 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
308 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
224 KB |
Output is correct |
21 |
Correct |
0 ms |
304 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
312 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
308 KB |
Output is correct |
13 |
Correct |
0 ms |
308 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
308 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
224 KB |
Output is correct |
21 |
Correct |
0 ms |
304 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
3 ms |
468 KB |
Output is correct |
29 |
Correct |
12 ms |
1172 KB |
Output is correct |
30 |
Correct |
14 ms |
1236 KB |
Output is correct |
31 |
Correct |
30 ms |
4664 KB |
Output is correct |
32 |
Correct |
17 ms |
1648 KB |
Output is correct |
33 |
Correct |
18 ms |
1844 KB |
Output is correct |
34 |
Correct |
18 ms |
2004 KB |
Output is correct |
35 |
Correct |
19 ms |
1808 KB |
Output is correct |
36 |
Correct |
18 ms |
1676 KB |
Output is correct |
37 |
Correct |
18 ms |
1848 KB |
Output is correct |
38 |
Correct |
19 ms |
1876 KB |
Output is correct |
39 |
Correct |
21 ms |
1908 KB |
Output is correct |
40 |
Correct |
23 ms |
1728 KB |
Output is correct |
41 |
Correct |
23 ms |
1688 KB |
Output is correct |
42 |
Correct |
16 ms |
1492 KB |
Output is correct |
43 |
Correct |
19 ms |
1964 KB |
Output is correct |
44 |
Correct |
18 ms |
1736 KB |
Output is correct |
45 |
Correct |
16 ms |
1596 KB |
Output is correct |
46 |
Correct |
25 ms |
3064 KB |
Output is correct |
47 |
Correct |
20 ms |
3056 KB |
Output is correct |
48 |
Correct |
27 ms |
5452 KB |
Output is correct |
49 |
Correct |
48 ms |
5424 KB |
Output is correct |
50 |
Correct |
46 ms |
5372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
312 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
308 KB |
Output is correct |
13 |
Correct |
0 ms |
308 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
308 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
224 KB |
Output is correct |
21 |
Correct |
0 ms |
304 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
312 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
308 KB |
Output is correct |
13 |
Correct |
0 ms |
308 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
308 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
224 KB |
Output is correct |
21 |
Correct |
0 ms |
304 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
3 ms |
468 KB |
Output is correct |
29 |
Correct |
12 ms |
1172 KB |
Output is correct |
30 |
Correct |
14 ms |
1236 KB |
Output is correct |
31 |
Correct |
30 ms |
4664 KB |
Output is correct |
32 |
Correct |
17 ms |
1648 KB |
Output is correct |
33 |
Correct |
18 ms |
1844 KB |
Output is correct |
34 |
Correct |
18 ms |
2004 KB |
Output is correct |
35 |
Correct |
19 ms |
1808 KB |
Output is correct |
36 |
Correct |
18 ms |
1676 KB |
Output is correct |
37 |
Correct |
18 ms |
1848 KB |
Output is correct |
38 |
Correct |
19 ms |
1876 KB |
Output is correct |
39 |
Correct |
21 ms |
1908 KB |
Output is correct |
40 |
Correct |
23 ms |
1728 KB |
Output is correct |
41 |
Correct |
23 ms |
1688 KB |
Output is correct |
42 |
Correct |
16 ms |
1492 KB |
Output is correct |
43 |
Correct |
19 ms |
1964 KB |
Output is correct |
44 |
Correct |
18 ms |
1736 KB |
Output is correct |
45 |
Correct |
16 ms |
1596 KB |
Output is correct |
46 |
Correct |
25 ms |
3064 KB |
Output is correct |
47 |
Correct |
20 ms |
3056 KB |
Output is correct |
48 |
Correct |
27 ms |
5452 KB |
Output is correct |
49 |
Correct |
48 ms |
5424 KB |
Output is correct |
50 |
Correct |
46 ms |
5372 KB |
Output is correct |
51 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
52 |
Halted |
0 ms |
0 KB |
- |