# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
211527 |
2020-03-20T16:50:23 Z |
Nnandi |
Nautilus (BOI19_nautilus) |
C++14 |
|
320 ms |
262148 KB |
#include <bits/stdc++.h>
using namespace std;
const int maxrc = 500;
const int maxn = 5000;
bool dp[maxrc][maxrc][maxn];
bool tab[maxrc][maxrc];
int r, c, m;
string dir;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>r>>c>>m;
for(int i=1;i<=r;i++) {
for(int j=1;j<=c;j++) {
char z;
cin>>z;
tab[i][j] = (z != '#');
dp[i][j][m] = (z != '#');
}
}
cin>>dir;
reverse(dir.begin(),dir.end());
int sol = 0;
for(int k=m-1;k>=0;k--) {
for(int i=1;i<=r;i++) {
for(int j=1;j<=c;j++) {
map<char,bool> most;
most['S'] = dp[i-1][j][k+1];
most['N'] = dp[i+1][j][k+1];
most['W'] = dp[i][j+1][k+1];
most['E'] = dp[i][j-1][k+1];
most['?'] = most['N'] || most['S'] || most['E'] || most['W'];
dp[i][j][k] = (most[dir[k]] && tab[i][j]);
if(k == 0 && dp[i][j][k]) sol++;
}
}
}
cout<<sol<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
311 ms |
41848 KB |
Output is correct |
2 |
Correct |
319 ms |
41848 KB |
Output is correct |
3 |
Correct |
311 ms |
41792 KB |
Output is correct |
4 |
Correct |
315 ms |
41848 KB |
Output is correct |
5 |
Correct |
308 ms |
41976 KB |
Output is correct |
6 |
Correct |
319 ms |
41852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
311 ms |
41848 KB |
Output is correct |
2 |
Correct |
319 ms |
41848 KB |
Output is correct |
3 |
Correct |
311 ms |
41792 KB |
Output is correct |
4 |
Correct |
315 ms |
41848 KB |
Output is correct |
5 |
Correct |
308 ms |
41976 KB |
Output is correct |
6 |
Correct |
319 ms |
41852 KB |
Output is correct |
7 |
Correct |
291 ms |
41848 KB |
Output is correct |
8 |
Correct |
313 ms |
41976 KB |
Output is correct |
9 |
Correct |
309 ms |
41848 KB |
Output is correct |
10 |
Correct |
312 ms |
41848 KB |
Output is correct |
11 |
Correct |
306 ms |
41848 KB |
Output is correct |
12 |
Correct |
284 ms |
41848 KB |
Output is correct |
13 |
Correct |
296 ms |
41976 KB |
Output is correct |
14 |
Correct |
311 ms |
41848 KB |
Output is correct |
15 |
Correct |
316 ms |
41968 KB |
Output is correct |
16 |
Correct |
310 ms |
41848 KB |
Output is correct |
17 |
Correct |
300 ms |
41896 KB |
Output is correct |
18 |
Correct |
304 ms |
41848 KB |
Output is correct |
19 |
Correct |
315 ms |
41848 KB |
Output is correct |
20 |
Correct |
320 ms |
41848 KB |
Output is correct |
21 |
Correct |
305 ms |
41848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
311 ms |
41848 KB |
Output is correct |
2 |
Correct |
319 ms |
41848 KB |
Output is correct |
3 |
Correct |
311 ms |
41792 KB |
Output is correct |
4 |
Correct |
315 ms |
41848 KB |
Output is correct |
5 |
Correct |
308 ms |
41976 KB |
Output is correct |
6 |
Correct |
319 ms |
41852 KB |
Output is correct |
7 |
Correct |
291 ms |
41848 KB |
Output is correct |
8 |
Correct |
313 ms |
41976 KB |
Output is correct |
9 |
Correct |
309 ms |
41848 KB |
Output is correct |
10 |
Correct |
312 ms |
41848 KB |
Output is correct |
11 |
Correct |
306 ms |
41848 KB |
Output is correct |
12 |
Correct |
284 ms |
41848 KB |
Output is correct |
13 |
Correct |
296 ms |
41976 KB |
Output is correct |
14 |
Correct |
311 ms |
41848 KB |
Output is correct |
15 |
Correct |
316 ms |
41968 KB |
Output is correct |
16 |
Correct |
310 ms |
41848 KB |
Output is correct |
17 |
Correct |
300 ms |
41896 KB |
Output is correct |
18 |
Correct |
304 ms |
41848 KB |
Output is correct |
19 |
Correct |
315 ms |
41848 KB |
Output is correct |
20 |
Correct |
320 ms |
41848 KB |
Output is correct |
21 |
Correct |
305 ms |
41848 KB |
Output is correct |
22 |
Runtime error |
112 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
23 |
Halted |
0 ms |
0 KB |
- |