답안 #514799

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
514799 2022-01-18T13:32:15 Z ymm Nautilus (BOI19_nautilus) C++17
100 / 100
185 ms 680 KB
///
///   What would happen if we used assembly language for CP?
///   Sorry, that was a strange thing to ask.
///

#include <bits/stdc++.h>
#define Loop(x,l,r) for(ll x = ll(l); x < ll(r); ++x)
#define LoopR(x,l,r) for(ll x = ll(r)-1; x >= ll(l); --x)
#define Kill(x) exit((cout << (x) << '\n', 0))
typedef long long ll;
typedef std::pair<int,int> pii;
typedef std::pair<ll,ll> pll;
using namespace std;

const int N = 510;
bitset<N> cur[2][N];
bitset<N> isl[N];
int n, m, k;

void up(char c){
	Loop(i,0,n){
		cur[1][i].reset();
		if( c=='?' || c=='E') {cur[1][i] |= cur[0][i]<<1; cur[1][i][m]=0;}
		if( c=='?' || c=='W')  cur[1][i] |= cur[0][i]>>1;
		if((c=='?' || c=='N') && i+1<n) cur[1][i] |= cur[0][i+1];
		if((c=='?' || c=='S') && i  >0) cur[1][i] |= cur[0][i-1];
		cur[1][i] &= isl[i];
	}
	Loop(i,0,n) cur[0][i] = cur[1][i];
}

int main()
{
	cin.tie(0) -> sync_with_stdio(false);
	cin >> n >> m >> k;
	Loop(i,0,n) Loop(j,0,m){
		char c;
		cin >> c;
		isl[i][j] = cur[0][i][j] = c=='.';
	}
	Loop(i,0,k){
		char c;
		cin >> c;
		up(c);
	}
	int ans = 0;
	Loop(i,0,n) ans += cur[0][i].count();
	cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 324 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 232 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 8 ms 332 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 118 ms 644 KB Output is correct
2 Correct 114 ms 640 KB Output is correct
3 Correct 97 ms 640 KB Output is correct
4 Correct 84 ms 640 KB Output is correct
5 Correct 84 ms 680 KB Output is correct
6 Correct 166 ms 636 KB Output is correct
7 Correct 132 ms 592 KB Output is correct
8 Correct 123 ms 564 KB Output is correct
9 Correct 135 ms 644 KB Output is correct
10 Correct 124 ms 596 KB Output is correct
11 Correct 168 ms 640 KB Output is correct
12 Correct 159 ms 644 KB Output is correct
13 Correct 185 ms 576 KB Output is correct
14 Correct 165 ms 636 KB Output is correct
15 Correct 152 ms 636 KB Output is correct
16 Correct 8 ms 332 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 320 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 2 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 2 ms 324 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 316 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 232 KB Output is correct
33 Correct 1 ms 324 KB Output is correct
34 Correct 1 ms 324 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 332 KB Output is correct