# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
594176 |
2022-07-12T07:46:26 Z |
이동현(#8435) |
영역 (JOI16_ho_t4) |
C++17 |
|
313 ms |
42872 KB |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, k; cin >> n >> k;
string s; cin >> s;
map<int, map<int, int>> mp, did;
int x = 0, y = 0;
mp[x][y] = 1;
int ans = 0, lans;
for(int rep = 0; rep < min(100, k); ++rep){
lans = ans;
for(int i = 0; i < n; ++i){
if(s[i] == 'E') ++y;
else if(s[i] == 'W') --y;
else if(s[i] == 'N') --x;
else if(s[i] == 'S') ++x;
++mp[x][y];
for(int xx = -1; xx < 1; ++xx){
for(int yy = -1; yy < 1; ++yy){
if(did[x + xx][y + yy]) continue;
auto&m1 = mp[x + xx][y + yy];
auto&m2 = mp[x + xx][y + 1 + yy];
auto&m3 = mp[x + 1 + xx][y + yy];
auto&m4 = mp[x + 1 + xx][y + 1 + yy];
if(m1 > 0 && m2 > 0 && m3 > 0 && m4 > 0){
++ans;
did[x + xx][y + yy] = 1;
}
}
}
}
}
cout << ans + (ans - lans) * (k - min(100, k)) << '\n';
return 0;
}
Compilation message
2016_ho_t4.cpp: In function 'int main()':
2016_ho_t4.cpp:37:24: warning: 'lans' may be used uninitialized in this function [-Wmaybe-uninitialized]
37 | cout << ans + (ans - lans) * (k - min(100, k)) << '\n';
| ~~~~~^~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
320 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
320 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
1 ms |
320 KB |
Output is correct |
25 |
Correct |
1 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
320 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
320 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
1 ms |
320 KB |
Output is correct |
25 |
Correct |
1 ms |
328 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
4 ms |
468 KB |
Output is correct |
28 |
Correct |
11 ms |
828 KB |
Output is correct |
29 |
Correct |
48 ms |
2184 KB |
Output is correct |
30 |
Correct |
48 ms |
2244 KB |
Output is correct |
31 |
Correct |
224 ms |
23464 KB |
Output is correct |
32 |
Correct |
72 ms |
2840 KB |
Output is correct |
33 |
Correct |
92 ms |
3664 KB |
Output is correct |
34 |
Correct |
92 ms |
4420 KB |
Output is correct |
35 |
Correct |
73 ms |
3548 KB |
Output is correct |
36 |
Correct |
67 ms |
3020 KB |
Output is correct |
37 |
Correct |
85 ms |
3436 KB |
Output is correct |
38 |
Correct |
77 ms |
3404 KB |
Output is correct |
39 |
Correct |
76 ms |
3516 KB |
Output is correct |
40 |
Correct |
70 ms |
3024 KB |
Output is correct |
41 |
Correct |
63 ms |
2948 KB |
Output is correct |
42 |
Correct |
56 ms |
2328 KB |
Output is correct |
43 |
Correct |
83 ms |
3876 KB |
Output is correct |
44 |
Correct |
72 ms |
3292 KB |
Output is correct |
45 |
Correct |
64 ms |
2852 KB |
Output is correct |
46 |
Correct |
172 ms |
16900 KB |
Output is correct |
47 |
Correct |
196 ms |
12268 KB |
Output is correct |
48 |
Correct |
249 ms |
21560 KB |
Output is correct |
49 |
Correct |
300 ms |
42872 KB |
Output is correct |
50 |
Correct |
313 ms |
42768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
320 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
320 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
1 ms |
320 KB |
Output is correct |
25 |
Correct |
1 ms |
328 KB |
Output is correct |
26 |
Correct |
4 ms |
724 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
6 ms |
956 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
3 ms |
448 KB |
Output is correct |
31 |
Correct |
3 ms |
468 KB |
Output is correct |
32 |
Correct |
4 ms |
596 KB |
Output is correct |
33 |
Incorrect |
4 ms |
724 KB |
Output isn't correct |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
320 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
320 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
1 ms |
320 KB |
Output is correct |
25 |
Correct |
1 ms |
328 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
4 ms |
468 KB |
Output is correct |
28 |
Correct |
11 ms |
828 KB |
Output is correct |
29 |
Correct |
48 ms |
2184 KB |
Output is correct |
30 |
Correct |
48 ms |
2244 KB |
Output is correct |
31 |
Correct |
224 ms |
23464 KB |
Output is correct |
32 |
Correct |
72 ms |
2840 KB |
Output is correct |
33 |
Correct |
92 ms |
3664 KB |
Output is correct |
34 |
Correct |
92 ms |
4420 KB |
Output is correct |
35 |
Correct |
73 ms |
3548 KB |
Output is correct |
36 |
Correct |
67 ms |
3020 KB |
Output is correct |
37 |
Correct |
85 ms |
3436 KB |
Output is correct |
38 |
Correct |
77 ms |
3404 KB |
Output is correct |
39 |
Correct |
76 ms |
3516 KB |
Output is correct |
40 |
Correct |
70 ms |
3024 KB |
Output is correct |
41 |
Correct |
63 ms |
2948 KB |
Output is correct |
42 |
Correct |
56 ms |
2328 KB |
Output is correct |
43 |
Correct |
83 ms |
3876 KB |
Output is correct |
44 |
Correct |
72 ms |
3292 KB |
Output is correct |
45 |
Correct |
64 ms |
2852 KB |
Output is correct |
46 |
Correct |
172 ms |
16900 KB |
Output is correct |
47 |
Correct |
196 ms |
12268 KB |
Output is correct |
48 |
Correct |
249 ms |
21560 KB |
Output is correct |
49 |
Correct |
300 ms |
42872 KB |
Output is correct |
50 |
Correct |
313 ms |
42768 KB |
Output is correct |
51 |
Correct |
4 ms |
724 KB |
Output is correct |
52 |
Correct |
1 ms |
212 KB |
Output is correct |
53 |
Correct |
6 ms |
956 KB |
Output is correct |
54 |
Correct |
1 ms |
340 KB |
Output is correct |
55 |
Correct |
3 ms |
448 KB |
Output is correct |
56 |
Correct |
3 ms |
468 KB |
Output is correct |
57 |
Correct |
4 ms |
596 KB |
Output is correct |
58 |
Incorrect |
4 ms |
724 KB |
Output isn't correct |
59 |
Halted |
0 ms |
0 KB |
- |