# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
336058 |
2020-12-14T15:24:52 Z |
Sho10 |
Nautilus (BOI19_nautilus) |
C++14 |
|
20 ms |
1132 KB |
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,m,k;
bitset<250005>a,dp;
int32_t main(){
CODE_START;
cin>>n>>m>>k;
for(ll i=0;i<=n+1;i++)
{
for(ll j=0;j<=m+1;j++)
{
a[(m+2)*i+j]=0;
}
}
for(ll i=1;i<=n;i++)
{
string x;
cin>>x;
for(ll j=1;j<=m;j++)
{
a[(m+2)*i+j]=(x[j-1]=='.');
}
}
dp|=a;
string s;
cin>>s;
for(auto it : s){
if(it=='N'){
dp=(a&(dp>>(m+2)));
}else if(it=='S'){
dp=(a&(dp<<(m+2)));
}else if(it=='E'){
dp=(a&(dp<<1));
}else if(it=='W'){
dp=(a&(dp>>1));
}else {
dp=(a&((dp<<1)|(dp>>1)|(dp<<(m+2))|(dp>>(m+2))));
}
}
cout<<dp.count()<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
492 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
2 ms |
492 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
492 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
2 ms |
492 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Correct |
3 ms |
620 KB |
Output is correct |
8 |
Correct |
3 ms |
620 KB |
Output is correct |
9 |
Correct |
3 ms |
620 KB |
Output is correct |
10 |
Correct |
3 ms |
620 KB |
Output is correct |
11 |
Correct |
3 ms |
620 KB |
Output is correct |
12 |
Correct |
4 ms |
620 KB |
Output is correct |
13 |
Correct |
4 ms |
620 KB |
Output is correct |
14 |
Correct |
4 ms |
620 KB |
Output is correct |
15 |
Correct |
4 ms |
620 KB |
Output is correct |
16 |
Correct |
4 ms |
620 KB |
Output is correct |
17 |
Correct |
4 ms |
620 KB |
Output is correct |
18 |
Correct |
5 ms |
620 KB |
Output is correct |
19 |
Correct |
5 ms |
620 KB |
Output is correct |
20 |
Correct |
4 ms |
620 KB |
Output is correct |
21 |
Correct |
4 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
492 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
2 ms |
492 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Correct |
3 ms |
620 KB |
Output is correct |
8 |
Correct |
3 ms |
620 KB |
Output is correct |
9 |
Correct |
3 ms |
620 KB |
Output is correct |
10 |
Correct |
3 ms |
620 KB |
Output is correct |
11 |
Correct |
3 ms |
620 KB |
Output is correct |
12 |
Correct |
4 ms |
620 KB |
Output is correct |
13 |
Correct |
4 ms |
620 KB |
Output is correct |
14 |
Correct |
4 ms |
620 KB |
Output is correct |
15 |
Correct |
4 ms |
620 KB |
Output is correct |
16 |
Correct |
4 ms |
620 KB |
Output is correct |
17 |
Correct |
4 ms |
620 KB |
Output is correct |
18 |
Correct |
5 ms |
620 KB |
Output is correct |
19 |
Correct |
5 ms |
620 KB |
Output is correct |
20 |
Correct |
4 ms |
620 KB |
Output is correct |
21 |
Correct |
4 ms |
620 KB |
Output is correct |
22 |
Runtime error |
20 ms |
1132 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
23 |
Halted |
0 ms |
0 KB |
- |