답안 #771420

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
771420 2023-07-03T00:57:15 Z gggkik 영역 (JOI16_ho_t4) C++14
15 / 100
29 ms 5076 KB
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
#define ll long long
set<pii> s;
int dx[512], dy[512];
int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n, k; cin >> n >> k;
    string A; cin >> A;
    dx['S']--, dx['N']++, dy['E']++, dy['W']--;
    int x = 0, y = 0;
    s.insert({x,y});
    ll dc = 0,ct = 0, pc = 0;
    for(;k;){
        k--;
        for(char i : A) {
            x += dx[i], y += dy[i];
            s.insert({x,y});
        }
        ll c = 0;
        for(auto i : s) if(
            s.find({i.first+1,i.second}) != s.end() &&
            s.find({i.first,i.second+1}) != s.end() &&
            s.find({i.first+1,i.second+1}) != s.end()
        ) c++;
        if(c-pc==dc) ct++;
        else dc = c-pc, ct = 1;
        pc = c;
        if(ct>=10) break;
    }
    cout << pc+dc*k;
}

Compilation message

2016_ho_t4.cpp: In function 'int main()':
2016_ho_t4.cpp:18:21: warning: array subscript has type 'char' [-Wchar-subscripts]
   18 |             x += dx[i], y += dy[i];
      |                     ^
2016_ho_t4.cpp:18:33: warning: array subscript has type 'char' [-Wchar-subscripts]
   18 |             x += dx[i], y += dy[i];
      |                                 ^
# 결과 실행 시간 메모리 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 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 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 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 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 0 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 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 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 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 2 ms 468 KB Output is correct
29 Correct 7 ms 980 KB Output is correct
30 Correct 8 ms 1084 KB Output is correct
31 Correct 20 ms 4308 KB Output is correct
32 Correct 13 ms 1364 KB Output is correct
33 Correct 13 ms 1612 KB Output is correct
34 Correct 12 ms 1696 KB Output is correct
35 Correct 12 ms 1544 KB Output is correct
36 Correct 12 ms 1412 KB Output is correct
37 Correct 13 ms 1516 KB Output is correct
38 Correct 12 ms 1400 KB Output is correct
39 Correct 12 ms 1560 KB Output is correct
40 Correct 12 ms 1364 KB Output is correct
41 Correct 11 ms 1336 KB Output is correct
42 Correct 10 ms 1160 KB Output is correct
43 Correct 12 ms 1620 KB Output is correct
44 Correct 12 ms 1364 KB Output is correct
45 Correct 12 ms 1308 KB Output is correct
46 Correct 15 ms 2724 KB Output is correct
47 Correct 14 ms 2776 KB Output is correct
48 Correct 18 ms 5076 KB Output is correct
49 Correct 28 ms 5076 KB Output is correct
50 Correct 29 ms 5008 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 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 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 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 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 284 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Incorrect 1 ms 212 KB Output isn't correct
39 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 0 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 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 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 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 2 ms 468 KB Output is correct
29 Correct 7 ms 980 KB Output is correct
30 Correct 8 ms 1084 KB Output is correct
31 Correct 20 ms 4308 KB Output is correct
32 Correct 13 ms 1364 KB Output is correct
33 Correct 13 ms 1612 KB Output is correct
34 Correct 12 ms 1696 KB Output is correct
35 Correct 12 ms 1544 KB Output is correct
36 Correct 12 ms 1412 KB Output is correct
37 Correct 13 ms 1516 KB Output is correct
38 Correct 12 ms 1400 KB Output is correct
39 Correct 12 ms 1560 KB Output is correct
40 Correct 12 ms 1364 KB Output is correct
41 Correct 11 ms 1336 KB Output is correct
42 Correct 10 ms 1160 KB Output is correct
43 Correct 12 ms 1620 KB Output is correct
44 Correct 12 ms 1364 KB Output is correct
45 Correct 12 ms 1308 KB Output is correct
46 Correct 15 ms 2724 KB Output is correct
47 Correct 14 ms 2776 KB Output is correct
48 Correct 18 ms 5076 KB Output is correct
49 Correct 28 ms 5076 KB Output is correct
50 Correct 29 ms 5008 KB Output is correct
51 Correct 0 ms 212 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 1 ms 284 KB Output is correct
57 Correct 2 ms 340 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Incorrect 1 ms 212 KB Output isn't correct
64 Halted 0 ms 0 KB -