Submission #117168

# Submission time Handle Problem Language Result Execution time Memory
117168 2019-06-15T06:08:47 Z onjo0127 None (JOI16_ho_t4) C++11
15 / 100
49 ms 5248 KB
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

set<pii> st;
char S[100009];

int cnt(set<pii>& S) {
    int ret = 0;
    for(auto& it: S) {
        int x, y; tie(x, y) = it;
        if(S.find({x+1, y}) != S.end() && S.find({x, y+1}) != S.end() && S.find({x+1, y+1}) != S.end()) ++ret;
    }
    return ret;
}

int main() {
    int N, K; scanf("%d%d",&N,&K);
    int x = 0, y = 0; st.insert({0, 0});
    for(int i=1; i<=N; i++) {
        scanf(" %c",&S[i]);
        if(S[i] == 'N') ++y;
        if(S[i] == 'S') --y;
        if(S[i] == 'E') ++x;
        if(S[i] == 'W') --x;
        st.insert({x, y});
    }
    printf("%d", cnt(st));
    return 0;
}

Compilation message

2016_ho_t4.cpp: In function 'int main()':
2016_ho_t4.cpp:18:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N, K; scanf("%d%d",&N,&K);
               ~~~~~^~~~~~~~~~~~~~
2016_ho_t4.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %c",&S[i]);
         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 368 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 368 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 5 ms 512 KB Output is correct
29 Correct 12 ms 1152 KB Output is correct
30 Correct 15 ms 1152 KB Output is correct
31 Correct 42 ms 4472 KB Output is correct
32 Correct 22 ms 1536 KB Output is correct
33 Correct 23 ms 1664 KB Output is correct
34 Correct 23 ms 1788 KB Output is correct
35 Correct 22 ms 1664 KB Output is correct
36 Correct 22 ms 1536 KB Output is correct
37 Correct 21 ms 1664 KB Output is correct
38 Correct 24 ms 1664 KB Output is correct
39 Correct 23 ms 1664 KB Output is correct
40 Correct 22 ms 1496 KB Output is correct
41 Correct 20 ms 1400 KB Output is correct
42 Correct 20 ms 1280 KB Output is correct
43 Correct 21 ms 1784 KB Output is correct
44 Correct 21 ms 1536 KB Output is correct
45 Correct 19 ms 1400 KB Output is correct
46 Correct 31 ms 2816 KB Output is correct
47 Correct 34 ms 2816 KB Output is correct
48 Correct 49 ms 5248 KB Output is correct
49 Correct 39 ms 5248 KB Output is correct
50 Correct 47 ms 5240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 368 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Incorrect 2 ms 256 KB Output isn't correct
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 368 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 5 ms 512 KB Output is correct
29 Correct 12 ms 1152 KB Output is correct
30 Correct 15 ms 1152 KB Output is correct
31 Correct 42 ms 4472 KB Output is correct
32 Correct 22 ms 1536 KB Output is correct
33 Correct 23 ms 1664 KB Output is correct
34 Correct 23 ms 1788 KB Output is correct
35 Correct 22 ms 1664 KB Output is correct
36 Correct 22 ms 1536 KB Output is correct
37 Correct 21 ms 1664 KB Output is correct
38 Correct 24 ms 1664 KB Output is correct
39 Correct 23 ms 1664 KB Output is correct
40 Correct 22 ms 1496 KB Output is correct
41 Correct 20 ms 1400 KB Output is correct
42 Correct 20 ms 1280 KB Output is correct
43 Correct 21 ms 1784 KB Output is correct
44 Correct 21 ms 1536 KB Output is correct
45 Correct 19 ms 1400 KB Output is correct
46 Correct 31 ms 2816 KB Output is correct
47 Correct 34 ms 2816 KB Output is correct
48 Correct 49 ms 5248 KB Output is correct
49 Correct 39 ms 5248 KB Output is correct
50 Correct 47 ms 5240 KB Output is correct
51 Incorrect 2 ms 256 KB Output isn't correct
52 Halted 0 ms 0 KB -