답안 #594073

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594073 2022-07-12T04:49:32 Z Cross_Ratio 영역 (JOI16_ho_t4) C++14
15 / 100
49 ms 6764 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> P;
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int N;
    int K;
    cin >> N >> K;
    string s;
    cin >> s;
    int i, j;
    int x = 0, y = 0;
    set<P> S;
    S.insert(P(0,0));
    for(i=0;i<N;i++) {
        if(s[i]=='E') x++;
        if(s[i]=='W') x--;
        if(s[i]=='N') y++;
        if(s[i]=='S') y--;
        S.insert(P(x,y));
    }
    int ans = 0;
    for(P k : S) {
        int x = k.first, y = k.second;
        if(S.find(P(x,y+1))!=S.end()&&S.find(P(x+1,y))!=S.end()&&S.find(P(x+1,y+1))!=S.end()) {
            ans++;
        }
    }
    cout << ans;
}

Compilation message

2016_ho_t4.cpp: In function 'int main()':
2016_ho_t4.cpp:14:12: warning: unused variable 'j' [-Wunused-variable]
   14 |     int i, j;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 256 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 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 1 ms 212 KB Output is correct
17 Correct 1 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 1 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 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 256 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 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 1 ms 212 KB Output is correct
17 Correct 1 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 1 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 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 1 ms 340 KB Output is correct
28 Correct 3 ms 496 KB Output is correct
29 Correct 8 ms 1236 KB Output is correct
30 Correct 13 ms 1492 KB Output is correct
31 Correct 32 ms 5740 KB Output is correct
32 Correct 14 ms 1740 KB Output is correct
33 Correct 15 ms 1988 KB Output is correct
34 Correct 15 ms 2116 KB Output is correct
35 Correct 15 ms 2040 KB Output is correct
36 Correct 16 ms 1748 KB Output is correct
37 Correct 16 ms 1888 KB Output is correct
38 Correct 14 ms 1924 KB Output is correct
39 Correct 16 ms 2004 KB Output is correct
40 Correct 16 ms 1772 KB Output is correct
41 Correct 18 ms 1748 KB Output is correct
42 Correct 14 ms 1492 KB Output is correct
43 Correct 21 ms 2056 KB Output is correct
44 Correct 15 ms 1848 KB Output is correct
45 Correct 12 ms 1700 KB Output is correct
46 Correct 24 ms 3640 KB Output is correct
47 Correct 20 ms 3648 KB Output is correct
48 Correct 29 ms 6740 KB Output is correct
49 Correct 49 ms 6764 KB Output is correct
50 Correct 48 ms 6740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 256 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 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 1 ms 212 KB Output is correct
17 Correct 1 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 1 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 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Incorrect 1 ms 340 KB Output isn't correct
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 256 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 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 1 ms 212 KB Output is correct
17 Correct 1 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 1 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 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 1 ms 340 KB Output is correct
28 Correct 3 ms 496 KB Output is correct
29 Correct 8 ms 1236 KB Output is correct
30 Correct 13 ms 1492 KB Output is correct
31 Correct 32 ms 5740 KB Output is correct
32 Correct 14 ms 1740 KB Output is correct
33 Correct 15 ms 1988 KB Output is correct
34 Correct 15 ms 2116 KB Output is correct
35 Correct 15 ms 2040 KB Output is correct
36 Correct 16 ms 1748 KB Output is correct
37 Correct 16 ms 1888 KB Output is correct
38 Correct 14 ms 1924 KB Output is correct
39 Correct 16 ms 2004 KB Output is correct
40 Correct 16 ms 1772 KB Output is correct
41 Correct 18 ms 1748 KB Output is correct
42 Correct 14 ms 1492 KB Output is correct
43 Correct 21 ms 2056 KB Output is correct
44 Correct 15 ms 1848 KB Output is correct
45 Correct 12 ms 1700 KB Output is correct
46 Correct 24 ms 3640 KB Output is correct
47 Correct 20 ms 3648 KB Output is correct
48 Correct 29 ms 6740 KB Output is correct
49 Correct 49 ms 6764 KB Output is correct
50 Correct 48 ms 6740 KB Output is correct
51 Incorrect 1 ms 340 KB Output isn't correct
52 Halted 0 ms 0 KB -