# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
568156 | 2022-05-24T17:56:16 Z | mat_v | Nautilus (BOI19_nautilus) | C++14 | 212 ms | 968 KB |
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i)) #define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i)) #define mod 998244353 #define xx first #define yy second #define all(a) (a).begin(), (a).end() #define pb push_back #define ll long long #define pii pair<int,int> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less) mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); int n,m,k; bitset<502*502> doz, poc; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m >> k; ff(j,0,m+1)doz[j] = 0; ff(j,0,m+1)doz[j+(n+1)*(m+2)] = 0; ff(i,1,n){ string s; cin >> s; doz[i*(m+2)] = 0; doz[i*(m+2)+m+1] = 0; ff(j,0,m - 1){ if(s[j] == '.')doz[i*(m+2)+j+1] = 1; else doz[i*(m+2)+j+1] = 0; } } poc = doz; string s; cin >> s; ff(i,0,k - 1){ if(s[i] == 'N'){ poc = doz&(poc>>(m+2)); } if(s[i] == 'E'){ poc = doz&(poc<<1); } if(s[i] == 'W'){ poc = doz&(poc>>1); } if(s[i] == 'S'){ poc = doz&(poc<<(m+2)); } if(s[i] == '?'){ poc = doz&((poc<<1)|(poc>>1)|(poc<<(m+2))|(poc>>(m+2))); } } int ans = 0; ff(i,1,n){ ff(j,1,m){ if(poc[i*(m+2)+j])ans++; } } cout << ans << "\n"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 596 KB | Output is correct |
2 | Correct | 2 ms | 596 KB | Output is correct |
3 | Correct | 2 ms | 596 KB | Output is correct |
4 | Correct | 2 ms | 596 KB | Output is correct |
5 | Correct | 2 ms | 596 KB | Output is correct |
6 | Correct | 2 ms | 580 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 596 KB | Output is correct |
2 | Correct | 2 ms | 596 KB | Output is correct |
3 | Correct | 2 ms | 596 KB | Output is correct |
4 | Correct | 2 ms | 596 KB | Output is correct |
5 | Correct | 2 ms | 596 KB | Output is correct |
6 | Correct | 2 ms | 580 KB | Output is correct |
7 | Correct | 3 ms | 596 KB | Output is correct |
8 | Correct | 3 ms | 584 KB | Output is correct |
9 | Correct | 3 ms | 616 KB | Output is correct |
10 | Correct | 3 ms | 596 KB | Output is correct |
11 | Correct | 3 ms | 596 KB | Output is correct |
12 | Correct | 4 ms | 596 KB | Output is correct |
13 | Correct | 4 ms | 596 KB | Output is correct |
14 | Correct | 4 ms | 596 KB | Output is correct |
15 | Correct | 4 ms | 596 KB | Output is correct |
16 | Correct | 4 ms | 596 KB | Output is correct |
17 | Correct | 4 ms | 596 KB | Output is correct |
18 | Correct | 5 ms | 596 KB | Output is correct |
19 | Correct | 4 ms | 596 KB | Output is correct |
20 | Correct | 5 ms | 580 KB | Output is correct |
21 | Correct | 5 ms | 596 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 596 KB | Output is correct |
2 | Correct | 2 ms | 596 KB | Output is correct |
3 | Correct | 2 ms | 596 KB | Output is correct |
4 | Correct | 2 ms | 596 KB | Output is correct |
5 | Correct | 2 ms | 596 KB | Output is correct |
6 | Correct | 2 ms | 580 KB | Output is correct |
7 | Correct | 3 ms | 596 KB | Output is correct |
8 | Correct | 3 ms | 584 KB | Output is correct |
9 | Correct | 3 ms | 616 KB | Output is correct |
10 | Correct | 3 ms | 596 KB | Output is correct |
11 | Correct | 3 ms | 596 KB | Output is correct |
12 | Correct | 4 ms | 596 KB | Output is correct |
13 | Correct | 4 ms | 596 KB | Output is correct |
14 | Correct | 4 ms | 596 KB | Output is correct |
15 | Correct | 4 ms | 596 KB | Output is correct |
16 | Correct | 4 ms | 596 KB | Output is correct |
17 | Correct | 4 ms | 596 KB | Output is correct |
18 | Correct | 5 ms | 596 KB | Output is correct |
19 | Correct | 4 ms | 596 KB | Output is correct |
20 | Correct | 5 ms | 580 KB | Output is correct |
21 | Correct | 5 ms | 596 KB | Output is correct |
22 | Correct | 91 ms | 920 KB | Output is correct |
23 | Correct | 115 ms | 912 KB | Output is correct |
24 | Correct | 98 ms | 852 KB | Output is correct |
25 | Correct | 88 ms | 968 KB | Output is correct |
26 | Correct | 93 ms | 924 KB | Output is correct |
27 | Correct | 145 ms | 924 KB | Output is correct |
28 | Correct | 148 ms | 912 KB | Output is correct |
29 | Correct | 140 ms | 924 KB | Output is correct |
30 | Correct | 138 ms | 936 KB | Output is correct |
31 | Correct | 139 ms | 916 KB | Output is correct |
32 | Correct | 212 ms | 920 KB | Output is correct |
33 | Correct | 198 ms | 916 KB | Output is correct |
34 | Correct | 180 ms | 912 KB | Output is correct |
35 | Correct | 195 ms | 916 KB | Output is correct |
36 | Correct | 183 ms | 916 KB | Output is correct |