# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1021862 |
2024-07-13T06:22:28 Z |
basa |
Nautilus (BOI19_nautilus) |
C++14 |
|
383 ms |
262144 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
string m;
int r, c, k;
string s[605];
bool vis[605][605][5005];
int dfs(int i, int j, int p){
if(i >= r || i < 0) return 0;
if(j >= c || j < 0) return 0;
if(s[i][j] == '#') return 0;
if(vis[i][j][p]) return 0;
vis[i][j][p] = 1;
if(p == (int)m.size()) return 1;
int ret = 0;
if(m[p] == 'N') ret = dfs(i - 1, j, p + 1);
if(m[p] == 'S') ret = dfs(i + 1, j, p + 1);
if(m[p] == 'E') ret = dfs(i, j + 1, p + 1);
if(m[p] == 'W') ret = dfs(i, j - 1, p + 1);
if(m[p] == '?'){
ret += dfs(i + 1, j, p + 1);
ret += dfs(i - 1, j, p + 1);
ret += dfs(i, j + 1, p + 1);
ret += dfs(i, j - 1, p + 1);
}
return ret;
}
signed main()
{
cin.tie(0) -> sync_with_stdio(0);
cin >> r >> c >> k;
for(int i = 0; i < r; i++) cin >> s[i];
cin >> m;
int ans = 0;
for(int i = 0; i < r; i++){
for(int j = 0; j < c; j++){
if(s[i][j] == '#') continue;
ans += dfs(i, j, 0);
}
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
41812 KB |
Output is correct |
2 |
Correct |
15 ms |
32860 KB |
Output is correct |
3 |
Correct |
11 ms |
24924 KB |
Output is correct |
4 |
Correct |
11 ms |
17316 KB |
Output is correct |
5 |
Correct |
5 ms |
9052 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
41812 KB |
Output is correct |
2 |
Correct |
15 ms |
32860 KB |
Output is correct |
3 |
Correct |
11 ms |
24924 KB |
Output is correct |
4 |
Correct |
11 ms |
17316 KB |
Output is correct |
5 |
Correct |
5 ms |
9052 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
35 ms |
41812 KB |
Output is correct |
8 |
Correct |
14 ms |
25180 KB |
Output is correct |
9 |
Correct |
12 ms |
17260 KB |
Output is correct |
10 |
Correct |
7 ms |
9092 KB |
Output is correct |
11 |
Correct |
0 ms |
604 KB |
Output is correct |
12 |
Correct |
43 ms |
41888 KB |
Output is correct |
13 |
Correct |
47 ms |
33984 KB |
Output is correct |
14 |
Correct |
30 ms |
25428 KB |
Output is correct |
15 |
Correct |
6 ms |
9052 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
45 ms |
41880 KB |
Output is correct |
18 |
Correct |
46 ms |
33948 KB |
Output is correct |
19 |
Correct |
15 ms |
17500 KB |
Output is correct |
20 |
Correct |
7 ms |
9304 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
41812 KB |
Output is correct |
2 |
Correct |
15 ms |
32860 KB |
Output is correct |
3 |
Correct |
11 ms |
24924 KB |
Output is correct |
4 |
Correct |
11 ms |
17316 KB |
Output is correct |
5 |
Correct |
5 ms |
9052 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
35 ms |
41812 KB |
Output is correct |
8 |
Correct |
14 ms |
25180 KB |
Output is correct |
9 |
Correct |
12 ms |
17260 KB |
Output is correct |
10 |
Correct |
7 ms |
9092 KB |
Output is correct |
11 |
Correct |
0 ms |
604 KB |
Output is correct |
12 |
Correct |
43 ms |
41888 KB |
Output is correct |
13 |
Correct |
47 ms |
33984 KB |
Output is correct |
14 |
Correct |
30 ms |
25428 KB |
Output is correct |
15 |
Correct |
6 ms |
9052 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
45 ms |
41880 KB |
Output is correct |
18 |
Correct |
46 ms |
33948 KB |
Output is correct |
19 |
Correct |
15 ms |
17500 KB |
Output is correct |
20 |
Correct |
7 ms |
9304 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Runtime error |
383 ms |
262144 KB |
Execution killed with signal 9 |
23 |
Halted |
0 ms |
0 KB |
- |