답안 #594178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594178 2022-07-12T07:47:41 Z 이동현(#8435) 영역 (JOI16_ho_t4) C++17
38 / 100
1000 ms 66388 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed 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(200ll, 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(200ll, 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(200ll, k)) << '\n';
      |                   ~~~~~^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 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 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 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 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 212 KB Output is correct
21 Correct 0 ms 212 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 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 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 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 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 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 212 KB Output is correct
21 Correct 0 ms 212 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 1 ms 212 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 904 KB Output is correct
29 Correct 38 ms 2732 KB Output is correct
30 Correct 50 ms 2704 KB Output is correct
31 Correct 315 ms 29828 KB Output is correct
32 Correct 63 ms 3632 KB Output is correct
33 Correct 74 ms 4560 KB Output is correct
34 Correct 82 ms 5632 KB Output is correct
35 Correct 78 ms 4340 KB Output is correct
36 Correct 71 ms 3788 KB Output is correct
37 Correct 71 ms 4288 KB Output is correct
38 Correct 69 ms 4268 KB Output is correct
39 Correct 71 ms 4444 KB Output is correct
40 Correct 69 ms 3692 KB Output is correct
41 Correct 67 ms 3532 KB Output is correct
42 Correct 66 ms 2892 KB Output is correct
43 Correct 84 ms 4872 KB Output is correct
44 Correct 66 ms 4124 KB Output is correct
45 Correct 64 ms 3488 KB Output is correct
46 Correct 270 ms 20756 KB Output is correct
47 Correct 223 ms 16040 KB Output is correct
48 Correct 276 ms 28492 KB Output is correct
49 Correct 360 ms 50524 KB Output is correct
50 Correct 370 ms 50500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 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 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 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 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 212 KB Output is correct
21 Correct 0 ms 212 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 1 ms 212 KB Output is correct
26 Correct 8 ms 1364 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 10 ms 2036 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 5 ms 724 KB Output is correct
31 Correct 5 ms 852 KB Output is correct
32 Correct 7 ms 980 KB Output is correct
33 Correct 8 ms 1364 KB Output is correct
34 Correct 11 ms 1620 KB Output is correct
35 Correct 10 ms 1712 KB Output is correct
36 Correct 6 ms 852 KB Output is correct
37 Correct 11 ms 1948 KB Output is correct
38 Correct 7 ms 724 KB Output is correct
39 Correct 9 ms 1212 KB Output is correct
40 Correct 2 ms 324 KB Output is correct
41 Correct 6 ms 672 KB Output is correct
42 Correct 4 ms 332 KB Output is correct
43 Correct 8 ms 1472 KB Output is correct
44 Correct 7 ms 596 KB Output is correct
45 Correct 6 ms 1348 KB Output is correct
46 Correct 5 ms 340 KB Output is correct
47 Correct 6 ms 740 KB Output is correct
48 Correct 10 ms 1024 KB Output is correct
49 Correct 5 ms 340 KB Output is correct
50 Correct 12 ms 3404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 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 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 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 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 212 KB Output is correct
21 Correct 0 ms 212 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 1 ms 212 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 904 KB Output is correct
29 Correct 38 ms 2732 KB Output is correct
30 Correct 50 ms 2704 KB Output is correct
31 Correct 315 ms 29828 KB Output is correct
32 Correct 63 ms 3632 KB Output is correct
33 Correct 74 ms 4560 KB Output is correct
34 Correct 82 ms 5632 KB Output is correct
35 Correct 78 ms 4340 KB Output is correct
36 Correct 71 ms 3788 KB Output is correct
37 Correct 71 ms 4288 KB Output is correct
38 Correct 69 ms 4268 KB Output is correct
39 Correct 71 ms 4444 KB Output is correct
40 Correct 69 ms 3692 KB Output is correct
41 Correct 67 ms 3532 KB Output is correct
42 Correct 66 ms 2892 KB Output is correct
43 Correct 84 ms 4872 KB Output is correct
44 Correct 66 ms 4124 KB Output is correct
45 Correct 64 ms 3488 KB Output is correct
46 Correct 270 ms 20756 KB Output is correct
47 Correct 223 ms 16040 KB Output is correct
48 Correct 276 ms 28492 KB Output is correct
49 Correct 360 ms 50524 KB Output is correct
50 Correct 370 ms 50500 KB Output is correct
51 Correct 8 ms 1364 KB Output is correct
52 Correct 2 ms 212 KB Output is correct
53 Correct 10 ms 2036 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 5 ms 724 KB Output is correct
56 Correct 5 ms 852 KB Output is correct
57 Correct 7 ms 980 KB Output is correct
58 Correct 8 ms 1364 KB Output is correct
59 Correct 11 ms 1620 KB Output is correct
60 Correct 10 ms 1712 KB Output is correct
61 Correct 6 ms 852 KB Output is correct
62 Correct 11 ms 1948 KB Output is correct
63 Correct 7 ms 724 KB Output is correct
64 Correct 9 ms 1212 KB Output is correct
65 Correct 2 ms 324 KB Output is correct
66 Correct 6 ms 672 KB Output is correct
67 Correct 4 ms 332 KB Output is correct
68 Correct 8 ms 1472 KB Output is correct
69 Correct 7 ms 596 KB Output is correct
70 Correct 6 ms 1348 KB Output is correct
71 Correct 5 ms 340 KB Output is correct
72 Correct 6 ms 740 KB Output is correct
73 Correct 10 ms 1024 KB Output is correct
74 Correct 5 ms 340 KB Output is correct
75 Correct 12 ms 3404 KB Output is correct
76 Correct 805 ms 21924 KB Output is correct
77 Correct 506 ms 704 KB Output is correct
78 Execution timed out 1094 ms 66388 KB Time limit exceeded
79 Halted 0 ms 0 KB -