답안 #336059

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336059 2020-12-14T15:25:17 Z Sho10 Nautilus (BOI19_nautilus) C++14
66 / 100
1000 ms 3820 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<2500005>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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1516 KB Output is correct
2 Correct 11 ms 1516 KB Output is correct
3 Correct 12 ms 1516 KB Output is correct
4 Correct 13 ms 1516 KB Output is correct
5 Correct 12 ms 1516 KB Output is correct
6 Correct 12 ms 1516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1516 KB Output is correct
2 Correct 11 ms 1516 KB Output is correct
3 Correct 12 ms 1516 KB Output is correct
4 Correct 13 ms 1516 KB Output is correct
5 Correct 12 ms 1516 KB Output is correct
6 Correct 12 ms 1516 KB Output is correct
7 Correct 21 ms 3436 KB Output is correct
8 Correct 20 ms 3436 KB Output is correct
9 Correct 23 ms 3436 KB Output is correct
10 Correct 24 ms 3436 KB Output is correct
11 Correct 23 ms 3564 KB Output is correct
12 Correct 33 ms 3436 KB Output is correct
13 Correct 32 ms 3436 KB Output is correct
14 Correct 32 ms 3436 KB Output is correct
15 Correct 32 ms 3436 KB Output is correct
16 Correct 32 ms 3436 KB Output is correct
17 Correct 39 ms 3052 KB Output is correct
18 Correct 48 ms 3052 KB Output is correct
19 Correct 48 ms 3052 KB Output is correct
20 Correct 48 ms 3052 KB Output is correct
21 Correct 39 ms 3052 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1516 KB Output is correct
2 Correct 11 ms 1516 KB Output is correct
3 Correct 12 ms 1516 KB Output is correct
4 Correct 13 ms 1516 KB Output is correct
5 Correct 12 ms 1516 KB Output is correct
6 Correct 12 ms 1516 KB Output is correct
7 Correct 21 ms 3436 KB Output is correct
8 Correct 20 ms 3436 KB Output is correct
9 Correct 23 ms 3436 KB Output is correct
10 Correct 24 ms 3436 KB Output is correct
11 Correct 23 ms 3564 KB Output is correct
12 Correct 33 ms 3436 KB Output is correct
13 Correct 32 ms 3436 KB Output is correct
14 Correct 32 ms 3436 KB Output is correct
15 Correct 32 ms 3436 KB Output is correct
16 Correct 32 ms 3436 KB Output is correct
17 Correct 39 ms 3052 KB Output is correct
18 Correct 48 ms 3052 KB Output is correct
19 Correct 48 ms 3052 KB Output is correct
20 Correct 48 ms 3052 KB Output is correct
21 Correct 39 ms 3052 KB Output is correct
22 Correct 908 ms 3820 KB Output is correct
23 Correct 898 ms 3820 KB Output is correct
24 Correct 895 ms 3820 KB Output is correct
25 Correct 877 ms 3760 KB Output is correct
26 Correct 870 ms 3820 KB Output is correct
27 Execution timed out 1051 ms 3692 KB Time limit exceeded
28 Halted 0 ms 0 KB -