답안 #496504

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
496504 2021-12-21T11:34:39 Z Ierus Nautilus (BOI19_nautilus) C++17
66 / 100
99 ms 195796 KB
#include<bits/stdc++.h>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
using namespace std;
#pragma GCC optimize ("unroll-loops,Ofast,O3")
#pragma GCC target("avx,avx2,fma")
#define F first
#define int short
#define S second
#define sz(x) (int)x.size()
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define NFS ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
const long long inf = 1e18+777;
const int N = 5555;
int n, m, K;
bitset<555> used[N][555];
signed main(){
	NFS;
	cin >> n >> m >> K;
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= m; ++j){
			char x; cin >> x;
			used[0][i][j] = (x == '.');
		}
	}
	string s; cin >> s; s = ' ' + s;
	for(int k = 1; k <= K; ++k){
		for(int i = 1; i <= n; ++i){
			used[k][i] = used[0][i];
			if(s[k] == 'N'){
				used[k][i] &= used[k-1][i+1];
			}
			if(s[k] == 'S'){
				used[k][i] &= used[k-1][i-1];
			}
			if(s[k] == 'E'){
				used[k][i] &= (used[k-1][i] << 1);
			}
			if(s[k] == 'W'){
				used[k][i] &= (used[k-1][i] >> 1);
			}
			if(s[k] == '?'){
				used[k][i] &= ((used[k-1][i] << 1)|(used[k-1][i] >> 1)|used[k-1][i-1]|used[k-1][i+1]);
			}
		}
	}
	int res = 0;
	for(int i = 1; i <= n; ++i){
		res += used[K][i].count();
	}
	cout << res;
};











# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 1 ms 1356 KB Output is correct
4 Correct 1 ms 1356 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 2 ms 1356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 1 ms 1356 KB Output is correct
4 Correct 1 ms 1356 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 2 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1400 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 1 ms 1356 KB Output is correct
15 Correct 1 ms 1356 KB Output is correct
16 Correct 1 ms 1356 KB Output is correct
17 Correct 1 ms 1356 KB Output is correct
18 Correct 1 ms 1356 KB Output is correct
19 Correct 1 ms 1356 KB Output is correct
20 Correct 2 ms 1356 KB Output is correct
21 Correct 1 ms 1356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 1 ms 1356 KB Output is correct
4 Correct 1 ms 1356 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 2 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1400 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 1 ms 1356 KB Output is correct
15 Correct 1 ms 1356 KB Output is correct
16 Correct 1 ms 1356 KB Output is correct
17 Correct 1 ms 1356 KB Output is correct
18 Correct 1 ms 1356 KB Output is correct
19 Correct 1 ms 1356 KB Output is correct
20 Correct 2 ms 1356 KB Output is correct
21 Correct 1 ms 1356 KB Output is correct
22 Incorrect 99 ms 195796 KB Output isn't correct
23 Halted 0 ms 0 KB -