# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
414708 | 2021-05-31T05:17:32 Z | juggernaut | Nautilus (BOI19_nautilus) | C++17 | 569 ms | 1220 KB |
#include<bits/stdc++.h> #define fr first #define sc second using namespace std; void usaco(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);} typedef long long ll; #define USING_ORDERED_SET 0 #if USING_ORDERED_SET #include<bits/extc++.h> using namespace __gnu_pbds; template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; #endif template<class T>void umax(T &a,T b){if(a<b)a=b;} template<class T>void umin(T &a,T b){if(b<a)a=b;} #ifdef IOI2021SG #define printl(args...)printf(args) #else #define printl(args...)((void)0) #endif int n,m,q; const int N=505; int main(){ #ifndef IOI2021SG ios_base::sync_with_stdio(false); cin.tie(0); #endif cin>>n>>m>>q; bitset<2*N*N>valid,dp; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++){ char ch; cin>>ch; if(ch=='.')valid.set(i*N+j,1); } dp=valid; for(int i=1;i<=q;i++){ char ch; cin>>ch; if(ch=='N')dp>>=N; else if(ch=='S')dp<<=N; else if(ch=='W')dp>>=1; else if(ch=='E')dp<<=1; else dp=((dp<<N)|(dp>>1)|(dp<<1)|(dp>>N)); dp&=valid; } cout<<dp.count(); } /* 5 9 7 ...##.... ..#.##..# ..#....## .##...#.. ....#.... WS?EE?? */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 844 KB | Output is correct |
2 | Correct | 3 ms | 844 KB | Output is correct |
3 | Correct | 3 ms | 844 KB | Output is correct |
4 | Correct | 4 ms | 844 KB | Output is correct |
5 | Correct | 3 ms | 972 KB | Output is correct |
6 | Correct | 3 ms | 844 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 844 KB | Output is correct |
2 | Correct | 3 ms | 844 KB | Output is correct |
3 | Correct | 3 ms | 844 KB | Output is correct |
4 | Correct | 4 ms | 844 KB | Output is correct |
5 | Correct | 3 ms | 972 KB | Output is correct |
6 | Correct | 3 ms | 844 KB | Output is correct |
7 | Correct | 5 ms | 844 KB | Output is correct |
8 | Correct | 5 ms | 864 KB | Output is correct |
9 | Correct | 6 ms | 844 KB | Output is correct |
10 | Correct | 6 ms | 844 KB | Output is correct |
11 | Correct | 5 ms | 844 KB | Output is correct |
12 | Correct | 8 ms | 844 KB | Output is correct |
13 | Correct | 9 ms | 872 KB | Output is correct |
14 | Correct | 9 ms | 844 KB | Output is correct |
15 | Correct | 10 ms | 844 KB | Output is correct |
16 | Correct | 8 ms | 844 KB | Output is correct |
17 | Correct | 11 ms | 868 KB | Output is correct |
18 | Correct | 14 ms | 844 KB | Output is correct |
19 | Correct | 11 ms | 864 KB | Output is correct |
20 | Correct | 11 ms | 868 KB | Output is correct |
21 | Correct | 14 ms | 872 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 844 KB | Output is correct |
2 | Correct | 3 ms | 844 KB | Output is correct |
3 | Correct | 3 ms | 844 KB | Output is correct |
4 | Correct | 4 ms | 844 KB | Output is correct |
5 | Correct | 3 ms | 972 KB | Output is correct |
6 | Correct | 3 ms | 844 KB | Output is correct |
7 | Correct | 5 ms | 844 KB | Output is correct |
8 | Correct | 5 ms | 864 KB | Output is correct |
9 | Correct | 6 ms | 844 KB | Output is correct |
10 | Correct | 6 ms | 844 KB | Output is correct |
11 | Correct | 5 ms | 844 KB | Output is correct |
12 | Correct | 8 ms | 844 KB | Output is correct |
13 | Correct | 9 ms | 872 KB | Output is correct |
14 | Correct | 9 ms | 844 KB | Output is correct |
15 | Correct | 10 ms | 844 KB | Output is correct |
16 | Correct | 8 ms | 844 KB | Output is correct |
17 | Correct | 11 ms | 868 KB | Output is correct |
18 | Correct | 14 ms | 844 KB | Output is correct |
19 | Correct | 11 ms | 864 KB | Output is correct |
20 | Correct | 11 ms | 868 KB | Output is correct |
21 | Correct | 14 ms | 872 KB | Output is correct |
22 | Correct | 198 ms | 864 KB | Output is correct |
23 | Correct | 210 ms | 1220 KB | Output is correct |
24 | Correct | 194 ms | 1112 KB | Output is correct |
25 | Correct | 195 ms | 1100 KB | Output is correct |
26 | Correct | 226 ms | 1108 KB | Output is correct |
27 | Correct | 357 ms | 1100 KB | Output is correct |
28 | Correct | 363 ms | 1108 KB | Output is correct |
29 | Correct | 364 ms | 1116 KB | Output is correct |
30 | Correct | 374 ms | 1108 KB | Output is correct |
31 | Correct | 350 ms | 1108 KB | Output is correct |
32 | Correct | 474 ms | 1100 KB | Output is correct |
33 | Correct | 569 ms | 1100 KB | Output is correct |
34 | Correct | 493 ms | 1100 KB | Output is correct |
35 | Correct | 477 ms | 1108 KB | Output is correct |
36 | Correct | 480 ms | 1220 KB | Output is correct |