Submission #594101

# Submission time Handle Problem Language Result Execution time Memory
594101 2022-07-12T05:41:19 Z 조영욱(#8434) None (JOI16_ho_t4) C++17
15 / 100
45 ms 5184 KB
#include <bits/stdc++.h>
using namespace std;

int n,k;
char str[100001];
typedef pair<int,int> P;

int main() {
    scanf("%d %d",&n,&k);
    scanf("%s",str);
    if (k<=5*n) {
        int ret=0;
        set<P> s;
        s.insert(P(0,0));
        int x=0;
        int y=0;
        for(int i=0;i<n;i++) {
            if (str[i]=='E') {
                x++;
            }
            if (str[i]=='W') {
                x--;
            }
            if (str[i]=='N') {
                y++;
            }
            if (str[i]=='S') {
                y--;
            }
            s.insert(P(x,y));
        }
        for(auto now:s) {
            bool flag=true;
            for(int i=1;i<4;i++) {
                if (s.find(P(now.first+i/2,now.second+i%2))==s.end()) {
                    flag=false;
                    break;
                }
            }
            if (flag) {
                ret++;
            }
        }
        printf("%d",ret);
        return 0;
    }
    return 0;
}

Compilation message

2016_ho_t4.cpp: In function 'int main()':
2016_ho_t4.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d",&n,&k);
      |     ~~~~~^~~~~~~~~~~~~~~
2016_ho_t4.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%s",str);
      |     ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 308 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 316 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 308 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 316 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 308 KB Output is correct
27 Correct 1 ms 308 KB Output is correct
28 Correct 3 ms 512 KB Output is correct
29 Correct 9 ms 1024 KB Output is correct
30 Correct 12 ms 1180 KB Output is correct
31 Correct 23 ms 4436 KB Output is correct
32 Correct 16 ms 1492 KB Output is correct
33 Correct 15 ms 1656 KB Output is correct
34 Correct 15 ms 1748 KB Output is correct
35 Correct 15 ms 1640 KB Output is correct
36 Correct 15 ms 1492 KB Output is correct
37 Correct 19 ms 1600 KB Output is correct
38 Correct 19 ms 1492 KB Output is correct
39 Correct 16 ms 1564 KB Output is correct
40 Correct 14 ms 1432 KB Output is correct
41 Correct 13 ms 1364 KB Output is correct
42 Correct 12 ms 1216 KB Output is correct
43 Correct 17 ms 1792 KB Output is correct
44 Correct 15 ms 1600 KB Output is correct
45 Correct 13 ms 1296 KB Output is correct
46 Correct 23 ms 2900 KB Output is correct
47 Correct 18 ms 2804 KB Output is correct
48 Correct 23 ms 5184 KB Output is correct
49 Correct 38 ms 5180 KB Output is correct
50 Correct 45 ms 5172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 308 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 316 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Incorrect 0 ms 212 KB Output isn't correct
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 308 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 316 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 308 KB Output is correct
27 Correct 1 ms 308 KB Output is correct
28 Correct 3 ms 512 KB Output is correct
29 Correct 9 ms 1024 KB Output is correct
30 Correct 12 ms 1180 KB Output is correct
31 Correct 23 ms 4436 KB Output is correct
32 Correct 16 ms 1492 KB Output is correct
33 Correct 15 ms 1656 KB Output is correct
34 Correct 15 ms 1748 KB Output is correct
35 Correct 15 ms 1640 KB Output is correct
36 Correct 15 ms 1492 KB Output is correct
37 Correct 19 ms 1600 KB Output is correct
38 Correct 19 ms 1492 KB Output is correct
39 Correct 16 ms 1564 KB Output is correct
40 Correct 14 ms 1432 KB Output is correct
41 Correct 13 ms 1364 KB Output is correct
42 Correct 12 ms 1216 KB Output is correct
43 Correct 17 ms 1792 KB Output is correct
44 Correct 15 ms 1600 KB Output is correct
45 Correct 13 ms 1296 KB Output is correct
46 Correct 23 ms 2900 KB Output is correct
47 Correct 18 ms 2804 KB Output is correct
48 Correct 23 ms 5184 KB Output is correct
49 Correct 38 ms 5180 KB Output is correct
50 Correct 45 ms 5172 KB Output is correct
51 Incorrect 0 ms 212 KB Output isn't correct
52 Halted 0 ms 0 KB -