# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1111317 | 2024-11-12T04:33:00 Z | hainam2k9 | Nautilus (BOI19_nautilus) | C++17 | 144 ms | 158888 KB |
#include <bits/stdc++.h> #define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0) #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout) #define ll long long #define ull unsigned long long #define i128 __int128 #define db long double #define sz(a) ((int)(a).size()) #define pb emplace_back #define pf emplace_front #define pob pop_back #define pof pop_front #define lb lower_bound #define ub upper_bound #define fi first #define se second #define ins emplace using namespace std; const int MOD = 1e9+7, MAXN = 1e5+5; const string NAME = ""; int n,m,k,rs=0; bitset<505> dp[5005][505],mask[505]; char c; int main() { tt; if(fopen((NAME + ".INP").c_str(), "r")) fo; cin >> n >> m >> k; for(int i = 1; i<=n; ++i) for(int j = 1; j<=m; ++j){ cin >> c; if(c=='.') dp[0][i][j]=1, mask[i][j]=1; } for(int i = 1; i<=k; ++i){ cin >> c; for(int j = 1; j<=n; ++j){ if(c=='N'||c=='?') dp[i][j]|=dp[i-1][j+1]; if(c=='S'||c=='?') dp[i][j]|=dp[i-1][j-1]; if(c=='W'||c=='?') dp[i][j]|=dp[i-1][j]>>1; if(c=='E'||c=='?') dp[i][j]|=dp[i-1][j]<<1; dp[i][j]&=mask[j]; } } for(int i = 1; i<=n; ++i) rs+=dp[k][i].count(); cout << rs; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4432 KB | Output is correct |
2 | Correct | 1 ms | 4432 KB | Output is correct |
3 | Correct | 1 ms | 4600 KB | Output is correct |
4 | Correct | 1 ms | 4580 KB | Output is correct |
5 | Correct | 1 ms | 4432 KB | Output is correct |
6 | Correct | 2 ms | 4432 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4432 KB | Output is correct |
2 | Correct | 1 ms | 4432 KB | Output is correct |
3 | Correct | 1 ms | 4600 KB | Output is correct |
4 | Correct | 1 ms | 4580 KB | Output is correct |
5 | Correct | 1 ms | 4432 KB | Output is correct |
6 | Correct | 2 ms | 4432 KB | Output is correct |
7 | Correct | 1 ms | 4432 KB | Output is correct |
8 | Correct | 2 ms | 4432 KB | Output is correct |
9 | Correct | 2 ms | 4608 KB | Output is correct |
10 | Correct | 2 ms | 4432 KB | Output is correct |
11 | Correct | 1 ms | 4432 KB | Output is correct |
12 | Correct | 2 ms | 4432 KB | Output is correct |
13 | Correct | 3 ms | 4432 KB | Output is correct |
14 | Correct | 2 ms | 4812 KB | Output is correct |
15 | Correct | 2 ms | 4432 KB | Output is correct |
16 | Correct | 2 ms | 4432 KB | Output is correct |
17 | Correct | 2 ms | 4476 KB | Output is correct |
18 | Correct | 2 ms | 4432 KB | Output is correct |
19 | Correct | 2 ms | 4432 KB | Output is correct |
20 | Correct | 2 ms | 4432 KB | Output is correct |
21 | Correct | 2 ms | 4540 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4432 KB | Output is correct |
2 | Correct | 1 ms | 4432 KB | Output is correct |
3 | Correct | 1 ms | 4600 KB | Output is correct |
4 | Correct | 1 ms | 4580 KB | Output is correct |
5 | Correct | 1 ms | 4432 KB | Output is correct |
6 | Correct | 2 ms | 4432 KB | Output is correct |
7 | Correct | 1 ms | 4432 KB | Output is correct |
8 | Correct | 2 ms | 4432 KB | Output is correct |
9 | Correct | 2 ms | 4608 KB | Output is correct |
10 | Correct | 2 ms | 4432 KB | Output is correct |
11 | Correct | 1 ms | 4432 KB | Output is correct |
12 | Correct | 2 ms | 4432 KB | Output is correct |
13 | Correct | 3 ms | 4432 KB | Output is correct |
14 | Correct | 2 ms | 4812 KB | Output is correct |
15 | Correct | 2 ms | 4432 KB | Output is correct |
16 | Correct | 2 ms | 4432 KB | Output is correct |
17 | Correct | 2 ms | 4476 KB | Output is correct |
18 | Correct | 2 ms | 4432 KB | Output is correct |
19 | Correct | 2 ms | 4432 KB | Output is correct |
20 | Correct | 2 ms | 4432 KB | Output is correct |
21 | Correct | 2 ms | 4540 KB | Output is correct |
22 | Correct | 84 ms | 158888 KB | Output is correct |
23 | Correct | 87 ms | 158792 KB | Output is correct |
24 | Correct | 77 ms | 158764 KB | Output is correct |
25 | Correct | 78 ms | 158792 KB | Output is correct |
26 | Correct | 91 ms | 158624 KB | Output is correct |
27 | Correct | 117 ms | 158652 KB | Output is correct |
28 | Correct | 111 ms | 158800 KB | Output is correct |
29 | Correct | 109 ms | 158792 KB | Output is correct |
30 | Correct | 110 ms | 158792 KB | Output is correct |
31 | Correct | 109 ms | 158792 KB | Output is correct |
32 | Correct | 144 ms | 158844 KB | Output is correct |
33 | Correct | 133 ms | 158788 KB | Output is correct |
34 | Correct | 133 ms | 158680 KB | Output is correct |
35 | Correct | 138 ms | 158792 KB | Output is correct |
36 | Correct | 136 ms | 158840 KB | Output is correct |