# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
646100 |
2022-09-28T16:11:04 Z |
dozer |
Nautilus (BOI19_nautilus) |
C++14 |
|
26 ms |
1876 KB |
#include <bits/stdc++.h>
using namespace std;
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define sp " "
#define endl "\n"
#define pb push_back
#define pii pair<int, int>
#define st first
#define nd second
#define N 105
int arr[N][N], s[N], done[N][N];
int32_t main()
{
fastio();
pii dir[] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
map<char, int> val;
val['N'] = 0, val['E'] = 1, val['S'] = 2, val['W'] = 3, val['?'] = 4;
int r, c, m;
cin>>r>>c>>m;
vector<pii> curr;
for (int i = 1; i <= r; i++)
{
for (int j = 1; j <= c; j++)
{
char tmp;
cin>>tmp;
if (tmp == '.') arr[i][j] = 1, curr.pb({i, j});
}
}
for (int i = 1; i <= m; i++)
{
char tmp;
cin>>tmp;
s[i] = val[tmp];
}
for (int i = 1; i <= m; i++)
{
//cout<<curr.size()<<endl;
vector<pii> tmp;
for (auto j : curr)
{
int x = j.st, y = j.nd;
int k = s[i];
if (k == 4)
{
for (auto l : dir)
{
int a = x + l.st, b = y + l.nd;
if (arr[a][b] == 1 && done[a][b] < i + 1)
{
done[a][b] = i + 1;
tmp.pb({a, b});
}
}
}
else
{
pii l = dir[k];
int a = x + l.st, b = y + l.nd;
if (arr[a][b] == 1 && done[a][b] < i + 1)
{
done[a][b] = i + 1;
tmp.pb({a, b});
}
}
}
curr = tmp;
}
cout<<curr.size()<<endl;
cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<"seconds\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
644 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
644 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
324 KB |
Output is correct |
7 |
Correct |
14 ms |
644 KB |
Output is correct |
8 |
Correct |
5 ms |
468 KB |
Output is correct |
9 |
Correct |
2 ms |
456 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
18 ms |
720 KB |
Output is correct |
13 |
Correct |
20 ms |
604 KB |
Output is correct |
14 |
Correct |
17 ms |
468 KB |
Output is correct |
15 |
Correct |
2 ms |
468 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
18 ms |
724 KB |
Output is correct |
18 |
Correct |
26 ms |
612 KB |
Output is correct |
19 |
Correct |
13 ms |
468 KB |
Output is correct |
20 |
Correct |
4 ms |
468 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
644 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
324 KB |
Output is correct |
7 |
Correct |
14 ms |
644 KB |
Output is correct |
8 |
Correct |
5 ms |
468 KB |
Output is correct |
9 |
Correct |
2 ms |
456 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
18 ms |
720 KB |
Output is correct |
13 |
Correct |
20 ms |
604 KB |
Output is correct |
14 |
Correct |
17 ms |
468 KB |
Output is correct |
15 |
Correct |
2 ms |
468 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
18 ms |
724 KB |
Output is correct |
18 |
Correct |
26 ms |
612 KB |
Output is correct |
19 |
Correct |
13 ms |
468 KB |
Output is correct |
20 |
Correct |
4 ms |
468 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Runtime error |
2 ms |
1876 KB |
Execution killed with signal 11 |
23 |
Halted |
0 ms |
0 KB |
- |