# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
489135 |
2021-11-21T09:26:20 Z |
ak2006 |
Nautilus (BOI19_nautilus) |
C++14 |
|
126 ms |
262148 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
const ll mod = 1e9 + 7,inf = 1e18;
#define pb push_back
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
void setIO()
{
fast;
}
int main()
{
setIO();
int r,c,m;
cin>>r>>c>>m;
char g[r + 1][c + 1];
bool dp[r + 2][c + 2][m + 1];
memset(dp,false,sizeof(dp));
for (int i = 1;i<=r;i++)
for (int j = 1;j<=c;j++)
cin>>g[i][j],dp[i][j][0] = (g[i][j] != '#');
string s;
cin>>s;
int ans = 0;
for (int t = 1;t<=m;t++){
for (int i = 1;i<=r;i++){
for (int j = 1;j<=c;j++){
if (g[i][j] == '#')continue;
if (s[t - 1] == 'E')
dp[i][j][t] = dp[i][j - 1][t - 1];
else if (s[t - 1] == 'W')
dp[i][j][t] = dp[i][j + 1][t - 1];
else if (s[t - 1] == 'N')
dp[i][j][t] = dp[i + 1][j][t - 1];
else if (s[t - 1] == 'S')
dp[i][j][t] = dp[i - 1][j][t - 1];
else dp[i][j][t] = dp[i - 1][j][t - 1] or
dp[i + 1][j][t - 1] or
dp[i][j + 1][t - 1] or dp[i][j - 1][t - 1];
if (t == m)
ans += dp[i][j][t];
}
}
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1360 KB |
Output is correct |
2 |
Correct |
5 ms |
1348 KB |
Output is correct |
3 |
Correct |
7 ms |
1360 KB |
Output is correct |
4 |
Correct |
7 ms |
1360 KB |
Output is correct |
5 |
Correct |
4 ms |
1360 KB |
Output is correct |
6 |
Correct |
2 ms |
1360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1360 KB |
Output is correct |
2 |
Correct |
5 ms |
1348 KB |
Output is correct |
3 |
Correct |
7 ms |
1360 KB |
Output is correct |
4 |
Correct |
7 ms |
1360 KB |
Output is correct |
5 |
Correct |
4 ms |
1360 KB |
Output is correct |
6 |
Correct |
2 ms |
1360 KB |
Output is correct |
7 |
Correct |
6 ms |
1360 KB |
Output is correct |
8 |
Correct |
8 ms |
1360 KB |
Output is correct |
9 |
Correct |
6 ms |
1348 KB |
Output is correct |
10 |
Correct |
4 ms |
1360 KB |
Output is correct |
11 |
Correct |
2 ms |
1232 KB |
Output is correct |
12 |
Correct |
4 ms |
1360 KB |
Output is correct |
13 |
Correct |
7 ms |
1232 KB |
Output is correct |
14 |
Correct |
9 ms |
1232 KB |
Output is correct |
15 |
Correct |
4 ms |
1360 KB |
Output is correct |
16 |
Correct |
2 ms |
1360 KB |
Output is correct |
17 |
Correct |
4 ms |
1360 KB |
Output is correct |
18 |
Correct |
8 ms |
1360 KB |
Output is correct |
19 |
Correct |
8 ms |
1360 KB |
Output is correct |
20 |
Correct |
6 ms |
1488 KB |
Output is correct |
21 |
Correct |
2 ms |
1360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1360 KB |
Output is correct |
2 |
Correct |
5 ms |
1348 KB |
Output is correct |
3 |
Correct |
7 ms |
1360 KB |
Output is correct |
4 |
Correct |
7 ms |
1360 KB |
Output is correct |
5 |
Correct |
4 ms |
1360 KB |
Output is correct |
6 |
Correct |
2 ms |
1360 KB |
Output is correct |
7 |
Correct |
6 ms |
1360 KB |
Output is correct |
8 |
Correct |
8 ms |
1360 KB |
Output is correct |
9 |
Correct |
6 ms |
1348 KB |
Output is correct |
10 |
Correct |
4 ms |
1360 KB |
Output is correct |
11 |
Correct |
2 ms |
1232 KB |
Output is correct |
12 |
Correct |
4 ms |
1360 KB |
Output is correct |
13 |
Correct |
7 ms |
1232 KB |
Output is correct |
14 |
Correct |
9 ms |
1232 KB |
Output is correct |
15 |
Correct |
4 ms |
1360 KB |
Output is correct |
16 |
Correct |
2 ms |
1360 KB |
Output is correct |
17 |
Correct |
4 ms |
1360 KB |
Output is correct |
18 |
Correct |
8 ms |
1360 KB |
Output is correct |
19 |
Correct |
8 ms |
1360 KB |
Output is correct |
20 |
Correct |
6 ms |
1488 KB |
Output is correct |
21 |
Correct |
2 ms |
1360 KB |
Output is correct |
22 |
Runtime error |
126 ms |
262148 KB |
Execution killed with signal 9 |
23 |
Halted |
0 ms |
0 KB |
- |