# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
871702 | 2023-11-11T10:48:13 Z | Acanikolic | Nautilus (BOI19_nautilus) | C++14 | 155 ms | 856 KB |
#include <bits/stdc++.h> #define int long long #define pb push_back #define F first #define S second using namespace std; const long long N = 510; const long long mod = 1e9+7; const long long inf = 1e18; const int K = 510; bitset<K>pravi[N],resenje[N]; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int r,c,m; cin >> r >> c >> m; for(int i=1;i<=r;i++) { for(int j=1;j<=c;j++) { char x; cin >> x; pravi[i][j] = 0; if(x == '.') pravi[i][j] = 1; resenje[i][j] = 1; } resenje[i] = pravi[i] & resenje[i]; } string s; cin >> s; for(int sta=0;sta<s.size();sta++) { /* for(int i=1;i<=r;i++) { if(s[sta] == 'N') { resenje[i] = pravi[i] & resenje[i+1]; }else if(s[sta] == 'S') { resenje[i] = pravi[i] & resenje[i-1]; }else if(s[sta] == 'W') { resenje[i] = pravi[i] & (resenje[i] >> 1); }else if(s[sta] == 'E') { resenje[i] = pravi[i] & (resenje[i] << 1); }else { resenje[i] = pravi[i] & resenje[i+1]; resenje[i] |= pravi[i] & resenje[i-1]; resenje[i] |= pravi[i] & (resenje[i] << 1); resenje[i] |= pravi[i] & (resenje[i] >> 1); } }*/ if(s[sta] == 'N') { // gore for(int i=1;i<=r;i++) resenje[i] = pravi[i] & resenje[i+1]; }else if(s[sta] == 'S') { for(int i=r;i>=1;i--) resenje[i] = pravi[i] & resenje[i-1]; }else if(s[sta] == 'W') { for(int i=1;i<=r;i++) resenje[i] = pravi[i] & (resenje[i] >> 1); }else if(s[sta] == 'E') { for(int i=1;i<=r;i++) resenje[i] = pravi[i] & (resenje[i] << 1); }else { bitset<K>tmp[N]; for(int i=1;i<=r;i++) { tmp[i] |= pravi[i] & resenje[i+1]; tmp[i] |= pravi[i] & (resenje[i] >> 1); tmp[i] |= pravi[i] & (resenje[i] << 1); } for(int i=r;i>=1;i--) tmp[i] |= pravi[i] & (resenje[i-1]); for(int i=1;i<=r;i++) resenje[i] = tmp[i]; } } int res = 0; for(int i=1;i<=r;i++) { for(int j=1;j<=c;j++) res += resenje[i][j]; } cout << res; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 600 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 600 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 496 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 496 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 1 ms | 508 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 428 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 600 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 496 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 496 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 1 ms | 508 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 428 KB | Output is correct |
22 | Correct | 78 ms | 604 KB | Output is correct |
23 | Correct | 80 ms | 604 KB | Output is correct |
24 | Correct | 83 ms | 792 KB | Output is correct |
25 | Correct | 78 ms | 788 KB | Output is correct |
26 | Correct | 76 ms | 604 KB | Output is correct |
27 | Correct | 127 ms | 788 KB | Output is correct |
28 | Correct | 123 ms | 856 KB | Output is correct |
29 | Correct | 119 ms | 604 KB | Output is correct |
30 | Correct | 122 ms | 604 KB | Output is correct |
31 | Correct | 125 ms | 784 KB | Output is correct |
32 | Correct | 148 ms | 600 KB | Output is correct |
33 | Correct | 149 ms | 792 KB | Output is correct |
34 | Correct | 152 ms | 784 KB | Output is correct |
35 | Correct | 155 ms | 792 KB | Output is correct |
36 | Correct | 148 ms | 792 KB | Output is correct |