# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
221796 | 2020-04-11T07:51:58 Z | patrikpavic2 | Nautilus (BOI19_nautilus) | C++17 | 182 ms | 504 KB |
/** * user: ppavic * fname: Patrik * lname: Pavić * task: nautilus * score: 100.0 * date: 2019-05-04 07:21:03.128602 */ #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <vector> #include <map> #include <set> #include <deque> #include <bitset> #define X first #define Y second #define PB push_back using namespace std; const int N = 505; bitset < N > cur[N], nw[N], sm[N]; int n, m, l; char s[10 * N]; void move_N(){ for(int i = 0;i < n - 1;i++){ nw[i] |= cur[i + 1]; } } void move_S(){ for(int i = 1;i < n;i++){ nw[i] |= cur[i - 1]; } } void move_W(){ for(int i = 0;i < n ;i++){ nw[i] |= (cur[i] >> 1); } } void move_E(){ for(int i = 0;i < n ;i++){ nw[i] |= (cur[i] << 1); } } void update(){ for(int i = 0;i < n;i++) cur[i] = nw[i] & sm[i]; for(int i = 0;i < n;i++) nw[i].reset(); } void print(){ printf("\n"); for(int i = 0;i < n;i++){ for(int j = 0;j < m;j++){ printf("%d", (int)cur[i][j]); } printf("\n"); } printf("\n"); } int main(){ scanf("%d%d%d", &n, &m, &l); for(int i = 0;i < n;i++){ for(int j = 0;j < m;j++){ char c; scanf(" %c", &c); if(c == '.') sm[i][j] = 1; } cur[i] = sm[i]; } for(int i = 0;i < l;i++){ char c; scanf(" %c", &c); if(c == 'N' || c == '?') move_N(); if(c == 'S' || c == '?') move_S(); if(c == 'E' || c == '?') move_E(); if(c == 'W' || c == '?') move_W(); update(); //print(); } int sol = 0; for(int i = 0;i < n;i++){ sol += cur[i].count(); } printf("%d\n", sol); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 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 | 6 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 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 | 6 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 6 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 6 ms | 384 KB | Output is correct |
13 | Correct | 6 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 6 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 396 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 384 KB | Output is correct |
20 | Correct | 6 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 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 | 6 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 6 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 6 ms | 384 KB | Output is correct |
13 | Correct | 6 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 6 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 396 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 384 KB | Output is correct |
20 | Correct | 6 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
22 | Correct | 115 ms | 384 KB | Output is correct |
23 | Correct | 119 ms | 384 KB | Output is correct |
24 | Correct | 115 ms | 384 KB | Output is correct |
25 | Correct | 114 ms | 384 KB | Output is correct |
26 | Correct | 115 ms | 384 KB | Output is correct |
27 | Correct | 153 ms | 384 KB | Output is correct |
28 | Correct | 155 ms | 384 KB | Output is correct |
29 | Correct | 152 ms | 384 KB | Output is correct |
30 | Correct | 155 ms | 316 KB | Output is correct |
31 | Correct | 156 ms | 504 KB | Output is correct |
32 | Correct | 181 ms | 384 KB | Output is correct |
33 | Correct | 181 ms | 384 KB | Output is correct |
34 | Correct | 182 ms | 384 KB | Output is correct |
35 | Correct | 181 ms | 384 KB | Output is correct |
36 | Correct | 179 ms | 384 KB | Output is correct |