# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
241754 |
2020-06-25T12:35:17 Z |
dsjong |
None (JOI16_ho_t4) |
C++14 |
|
160 ms |
30676 KB |
#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, bool>mp;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k;
string s;
cin>>n>>k>>s;
assert(k==1 || n<=60);
int x=0, y=0;
mp[{0, 0}]=true;
set<pair<int, int>>v;
v.insert({0, 0});
for(int 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++;
mp[{x, y}]=true;
v.insert({x, y});
}
int dy=y, dx=x;
set<pair<int, int>>v2;
for(int i=0;i<k;i++){
for(auto [x, y]:v){
v2.insert({x+i*dx, y+i*dy});
mp[{x+i*dx, y+i*dy}];
}
}
int cnt=0;
for(auto i:v2){
int x=i.first, y=i.second;
if(mp[{x+1, y}] && mp[{x, y+1}] && mp[{x+1, y+1}]){
cnt++;
}
}
cout<<cnt;
}
Compilation message
2016_ho_t4.cpp: In function 'int main()':
2016_ho_t4.cpp:27:12: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
for(auto [x, y]:v){
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
436 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
436 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
7 ms |
640 KB |
Output is correct |
28 |
Correct |
10 ms |
1024 KB |
Output is correct |
29 |
Correct |
24 ms |
2816 KB |
Output is correct |
30 |
Correct |
29 ms |
3072 KB |
Output is correct |
31 |
Correct |
103 ms |
18808 KB |
Output is correct |
32 |
Correct |
38 ms |
3960 KB |
Output is correct |
33 |
Correct |
44 ms |
4728 KB |
Output is correct |
34 |
Correct |
49 ms |
5376 KB |
Output is correct |
35 |
Correct |
41 ms |
4600 KB |
Output is correct |
36 |
Correct |
42 ms |
4088 KB |
Output is correct |
37 |
Correct |
43 ms |
4472 KB |
Output is correct |
38 |
Correct |
41 ms |
4480 KB |
Output is correct |
39 |
Correct |
45 ms |
4600 KB |
Output is correct |
40 |
Correct |
38 ms |
4088 KB |
Output is correct |
41 |
Correct |
39 ms |
3832 KB |
Output is correct |
42 |
Correct |
32 ms |
3196 KB |
Output is correct |
43 |
Correct |
43 ms |
4984 KB |
Output is correct |
44 |
Correct |
40 ms |
4344 KB |
Output is correct |
45 |
Correct |
35 ms |
3712 KB |
Output is correct |
46 |
Correct |
67 ms |
11512 KB |
Output is correct |
47 |
Correct |
67 ms |
11512 KB |
Output is correct |
48 |
Correct |
111 ms |
22520 KB |
Output is correct |
49 |
Correct |
128 ms |
22392 KB |
Output is correct |
50 |
Correct |
122 ms |
22520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
436 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Incorrect |
160 ms |
30676 KB |
Output isn't correct |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
436 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
7 ms |
640 KB |
Output is correct |
28 |
Correct |
10 ms |
1024 KB |
Output is correct |
29 |
Correct |
24 ms |
2816 KB |
Output is correct |
30 |
Correct |
29 ms |
3072 KB |
Output is correct |
31 |
Correct |
103 ms |
18808 KB |
Output is correct |
32 |
Correct |
38 ms |
3960 KB |
Output is correct |
33 |
Correct |
44 ms |
4728 KB |
Output is correct |
34 |
Correct |
49 ms |
5376 KB |
Output is correct |
35 |
Correct |
41 ms |
4600 KB |
Output is correct |
36 |
Correct |
42 ms |
4088 KB |
Output is correct |
37 |
Correct |
43 ms |
4472 KB |
Output is correct |
38 |
Correct |
41 ms |
4480 KB |
Output is correct |
39 |
Correct |
45 ms |
4600 KB |
Output is correct |
40 |
Correct |
38 ms |
4088 KB |
Output is correct |
41 |
Correct |
39 ms |
3832 KB |
Output is correct |
42 |
Correct |
32 ms |
3196 KB |
Output is correct |
43 |
Correct |
43 ms |
4984 KB |
Output is correct |
44 |
Correct |
40 ms |
4344 KB |
Output is correct |
45 |
Correct |
35 ms |
3712 KB |
Output is correct |
46 |
Correct |
67 ms |
11512 KB |
Output is correct |
47 |
Correct |
67 ms |
11512 KB |
Output is correct |
48 |
Correct |
111 ms |
22520 KB |
Output is correct |
49 |
Correct |
128 ms |
22392 KB |
Output is correct |
50 |
Correct |
122 ms |
22520 KB |
Output is correct |
51 |
Incorrect |
160 ms |
30676 KB |
Output isn't correct |
52 |
Halted |
0 ms |
0 KB |
- |