답안 #860689

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
860689 2023-10-13T19:00:26 Z Iliya_ Nautilus (BOI19_nautilus) C++14
100 / 100
108 ms 1112 KB
//IN THE NAME OF GOD
#include<bits/stdc++.h>
#pragma GCC optimize("O2,unroll-loops")
#define endl '\n'
#define F first
#define S second
using namespace std;
typedef long long ll; 

const int N = 507;
bitset<N*N> must,ans,cop;

int32_t main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

     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; 
               if (x == '.') must[i*N+j] = ans[i*N+j] = 1;
               else must[i*N+j] = ans[i*N+j] = 0;
          }
     }
     for(int i=1; i<=m; i++){
          char x; cin >> x; 
          cop = ans; 
          if (x == 'N') ans = (cop >> N); 
          else if (x == 'S') ans = (cop << N); 
          else if (x == 'E') ans = (cop << 1);
          else if (x == 'W') ans = (cop >> 1);
          else ans = ((cop>>N)|(cop<<N)|(cop<<1)|(cop>>1));
          ans &= must; 
     }
     cout << ans.count() << endl;

     return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 2 ms 716 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 2 ms 716 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 2 ms 768 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 2 ms 604 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 3 ms 784 KB Output is correct
18 Correct 3 ms 720 KB Output is correct
19 Correct 3 ms 604 KB Output is correct
20 Correct 3 ms 604 KB Output is correct
21 Correct 3 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 2 ms 716 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 2 ms 768 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 2 ms 604 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 3 ms 784 KB Output is correct
18 Correct 3 ms 720 KB Output is correct
19 Correct 3 ms 604 KB Output is correct
20 Correct 3 ms 604 KB Output is correct
21 Correct 3 ms 604 KB Output is correct
22 Correct 57 ms 860 KB Output is correct
23 Correct 58 ms 860 KB Output is correct
24 Correct 59 ms 1060 KB Output is correct
25 Correct 56 ms 856 KB Output is correct
26 Correct 56 ms 1112 KB Output is correct
27 Correct 83 ms 1060 KB Output is correct
28 Correct 83 ms 1060 KB Output is correct
29 Correct 84 ms 860 KB Output is correct
30 Correct 84 ms 1060 KB Output is correct
31 Correct 88 ms 1076 KB Output is correct
32 Correct 101 ms 1028 KB Output is correct
33 Correct 108 ms 860 KB Output is correct
34 Correct 104 ms 860 KB Output is correct
35 Correct 104 ms 1028 KB Output is correct
36 Correct 102 ms 860 KB Output is correct