답안 #594103

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594103 2022-07-12T05:55:15 Z 이동현(#8435) 영역 (JOI16_ho_t4) C++17
15 / 100
285 ms 42700 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
    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;
    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 << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 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 0 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 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 0 ms 212 KB Output is correct
19 Correct 0 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 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 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 0 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 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 0 ms 212 KB Output is correct
19 Correct 0 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 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 1 ms 212 KB Output is correct
27 Correct 4 ms 468 KB Output is correct
28 Correct 12 ms 852 KB Output is correct
29 Correct 39 ms 2192 KB Output is correct
30 Correct 45 ms 2124 KB Output is correct
31 Correct 220 ms 23452 KB Output is correct
32 Correct 65 ms 2756 KB Output is correct
33 Correct 74 ms 3448 KB Output is correct
34 Correct 79 ms 4392 KB Output is correct
35 Correct 72 ms 3332 KB Output is correct
36 Correct 66 ms 2908 KB Output is correct
37 Correct 76 ms 3348 KB Output is correct
38 Correct 74 ms 3324 KB Output is correct
39 Correct 76 ms 3440 KB Output is correct
40 Correct 67 ms 2964 KB Output is correct
41 Correct 67 ms 2832 KB Output is correct
42 Correct 63 ms 2212 KB Output is correct
43 Correct 75 ms 3812 KB Output is correct
44 Correct 70 ms 3208 KB Output is correct
45 Correct 69 ms 2708 KB Output is correct
46 Correct 183 ms 16796 KB Output is correct
47 Correct 185 ms 12120 KB Output is correct
48 Correct 242 ms 21676 KB Output is correct
49 Correct 285 ms 42700 KB Output is correct
50 Correct 281 ms 42572 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 1 ms 212 KB Output is correct
4 Correct 0 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 0 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 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 0 ms 212 KB Output is correct
19 Correct 0 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 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 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 0 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 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 0 ms 212 KB Output is correct
19 Correct 0 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 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 1 ms 212 KB Output is correct
27 Correct 4 ms 468 KB Output is correct
28 Correct 12 ms 852 KB Output is correct
29 Correct 39 ms 2192 KB Output is correct
30 Correct 45 ms 2124 KB Output is correct
31 Correct 220 ms 23452 KB Output is correct
32 Correct 65 ms 2756 KB Output is correct
33 Correct 74 ms 3448 KB Output is correct
34 Correct 79 ms 4392 KB Output is correct
35 Correct 72 ms 3332 KB Output is correct
36 Correct 66 ms 2908 KB Output is correct
37 Correct 76 ms 3348 KB Output is correct
38 Correct 74 ms 3324 KB Output is correct
39 Correct 76 ms 3440 KB Output is correct
40 Correct 67 ms 2964 KB Output is correct
41 Correct 67 ms 2832 KB Output is correct
42 Correct 63 ms 2212 KB Output is correct
43 Correct 75 ms 3812 KB Output is correct
44 Correct 70 ms 3208 KB Output is correct
45 Correct 69 ms 2708 KB Output is correct
46 Correct 183 ms 16796 KB Output is correct
47 Correct 185 ms 12120 KB Output is correct
48 Correct 242 ms 21676 KB Output is correct
49 Correct 285 ms 42700 KB Output is correct
50 Correct 281 ms 42572 KB Output is correct
51 Incorrect 1 ms 212 KB Output isn't correct
52 Halted 0 ms 0 KB -