답안 #331663

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331663 2020-11-29T13:00:15 Z soroush Nautilus (BOI19_nautilus) C++14
66 / 100
3 ms 1516 KB
//*
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
//*/
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ll maxn  = 200;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);
 
#define pb push_back
#define endl '\n'
#define dokme(x) cout << x , exit(0)
#define migmig ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(x , y) memset(x , y , sizeof x)
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}
 
int n , m , t;
string s[maxn];
string p;

bitset < 510 > block[510] , dp[510][510];

int32_t main(){
    migmig;
	cin >> n >> m >> t;
	for(int i = 0 ; i < n ; i  ++)
		cin >> s[i];
	cin >> p;
	for(int i = 1 ; i <= n ; i ++)
		for(int j = 1; j <= m ; j ++)
			if(s[i - 1][j - 1] == '.')block[i][j] = dp[0][i][j] = 1;
	for(int j =1 ; j <= t ; j ++){
		char cur = p[j-1];
		for(int i = 1 ; i <= n ; i ++){
			if(cur == 'N')
				dp[j][i] = dp[j-1][i+1]&block[i]; 
			if(cur == 'S')
				dp[j][i] = dp[j-1][i-1]&block[i];
			if(cur == 'E')
				dp[j][i] = (dp[j-1][i] << 1)&block[i];
			if(cur == 'W')
				dp[j][i] = (dp[j-1][i] >> 1)&block[i];
			if(cur == '?')
				dp[j][i] = ((dp[j-1][i] << 1) | (dp[j-1][i] >> 1) | dp[j-1][i+1] | dp[j-1][i-1])&block[i];
		}
	}
	int ans = 0;
	for(int i = 1 ; i <= n ; i ++)
		ans += dp[t][i].count();
	cout << ans;
    return(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1388 KB Output is correct
2 Correct 1 ms 1388 KB Output is correct
3 Correct 1 ms 1388 KB Output is correct
4 Correct 1 ms 1388 KB Output is correct
5 Correct 1 ms 1388 KB Output is correct
6 Correct 1 ms 1388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1388 KB Output is correct
2 Correct 1 ms 1388 KB Output is correct
3 Correct 1 ms 1388 KB Output is correct
4 Correct 1 ms 1388 KB Output is correct
5 Correct 1 ms 1388 KB Output is correct
6 Correct 1 ms 1388 KB Output is correct
7 Correct 1 ms 1388 KB Output is correct
8 Correct 1 ms 1388 KB Output is correct
9 Correct 1 ms 1388 KB Output is correct
10 Correct 1 ms 1388 KB Output is correct
11 Correct 1 ms 1388 KB Output is correct
12 Correct 1 ms 1516 KB Output is correct
13 Correct 1 ms 1388 KB Output is correct
14 Correct 1 ms 1388 KB Output is correct
15 Correct 2 ms 1388 KB Output is correct
16 Correct 1 ms 1388 KB Output is correct
17 Correct 1 ms 1388 KB Output is correct
18 Correct 1 ms 1388 KB Output is correct
19 Correct 1 ms 1388 KB Output is correct
20 Correct 1 ms 1388 KB Output is correct
21 Correct 1 ms 1388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1388 KB Output is correct
2 Correct 1 ms 1388 KB Output is correct
3 Correct 1 ms 1388 KB Output is correct
4 Correct 1 ms 1388 KB Output is correct
5 Correct 1 ms 1388 KB Output is correct
6 Correct 1 ms 1388 KB Output is correct
7 Correct 1 ms 1388 KB Output is correct
8 Correct 1 ms 1388 KB Output is correct
9 Correct 1 ms 1388 KB Output is correct
10 Correct 1 ms 1388 KB Output is correct
11 Correct 1 ms 1388 KB Output is correct
12 Correct 1 ms 1516 KB Output is correct
13 Correct 1 ms 1388 KB Output is correct
14 Correct 1 ms 1388 KB Output is correct
15 Correct 2 ms 1388 KB Output is correct
16 Correct 1 ms 1388 KB Output is correct
17 Correct 1 ms 1388 KB Output is correct
18 Correct 1 ms 1388 KB Output is correct
19 Correct 1 ms 1388 KB Output is correct
20 Correct 1 ms 1388 KB Output is correct
21 Correct 1 ms 1388 KB Output is correct
22 Runtime error 3 ms 1084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Halted 0 ms 0 KB -