Submission #594177

# Submission time Handle Problem Language Result Execution time Memory
594177 2022-07-12T07:46:55 Z 이동현(#8435) None (JOI16_ho_t4) C++17
15 / 100
284 ms 42664 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(200, 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(200, 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(200, k)) << '\n';
      |                   ~~~~~^~~~~~~
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 260 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 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 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 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 260 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 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 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 1 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 5 ms 468 KB Output is correct
28 Correct 14 ms 776 KB Output is correct
29 Correct 44 ms 2124 KB Output is correct
30 Correct 45 ms 2124 KB Output is correct
31 Correct 213 ms 23504 KB Output is correct
32 Correct 64 ms 2836 KB Output is correct
33 Correct 72 ms 3520 KB Output is correct
34 Correct 89 ms 4304 KB Output is correct
35 Correct 75 ms 3340 KB Output is correct
36 Correct 63 ms 2956 KB Output is correct
37 Correct 71 ms 3252 KB Output is correct
38 Correct 76 ms 3248 KB Output is correct
39 Correct 83 ms 3424 KB Output is correct
40 Correct 69 ms 2864 KB Output is correct
41 Correct 71 ms 2780 KB Output is correct
42 Correct 64 ms 2272 KB Output is correct
43 Correct 87 ms 3704 KB Output is correct
44 Correct 76 ms 3252 KB Output is correct
45 Correct 65 ms 2764 KB Output is correct
46 Correct 182 ms 16848 KB Output is correct
47 Correct 193 ms 12140 KB Output is correct
48 Correct 244 ms 21516 KB Output is correct
49 Correct 284 ms 42664 KB Output is correct
50 Correct 276 ms 42636 KB Output is correct
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 260 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 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 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 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 7 ms 1108 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 9 ms 1620 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 7 ms 596 KB Output is correct
31 Correct 6 ms 724 KB Output is correct
32 Correct 8 ms 852 KB Output is correct
33 Incorrect 7 ms 1108 KB Output isn't correct
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 260 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 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 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 1 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 5 ms 468 KB Output is correct
28 Correct 14 ms 776 KB Output is correct
29 Correct 44 ms 2124 KB Output is correct
30 Correct 45 ms 2124 KB Output is correct
31 Correct 213 ms 23504 KB Output is correct
32 Correct 64 ms 2836 KB Output is correct
33 Correct 72 ms 3520 KB Output is correct
34 Correct 89 ms 4304 KB Output is correct
35 Correct 75 ms 3340 KB Output is correct
36 Correct 63 ms 2956 KB Output is correct
37 Correct 71 ms 3252 KB Output is correct
38 Correct 76 ms 3248 KB Output is correct
39 Correct 83 ms 3424 KB Output is correct
40 Correct 69 ms 2864 KB Output is correct
41 Correct 71 ms 2780 KB Output is correct
42 Correct 64 ms 2272 KB Output is correct
43 Correct 87 ms 3704 KB Output is correct
44 Correct 76 ms 3252 KB Output is correct
45 Correct 65 ms 2764 KB Output is correct
46 Correct 182 ms 16848 KB Output is correct
47 Correct 193 ms 12140 KB Output is correct
48 Correct 244 ms 21516 KB Output is correct
49 Correct 284 ms 42664 KB Output is correct
50 Correct 276 ms 42636 KB Output is correct
51 Correct 7 ms 1108 KB Output is correct
52 Correct 2 ms 212 KB Output is correct
53 Correct 9 ms 1620 KB Output is correct
54 Correct 2 ms 340 KB Output is correct
55 Correct 7 ms 596 KB Output is correct
56 Correct 6 ms 724 KB Output is correct
57 Correct 8 ms 852 KB Output is correct
58 Incorrect 7 ms 1108 KB Output isn't correct
59 Halted 0 ms 0 KB -