답안 #336067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336067 2020-12-14T16:16:27 Z Sho10 Nautilus (BOI19_nautilus) C++14
66 / 100
25 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;
int n,m,k;
bitset<250005>a,dp;
int32_t main(){
CODE_START;
cin>>n>>m>>k;
for(int i=0;i<=n+1;i++)
{
    for(int j=0;j<=m+1;j++)
    {
        a[(m+2)*i+j]=0;
    }
}
for(int i=1;i<=n;i++)
{
    string x;
    cin>>x;
    for(int 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 2 ms 492 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 504 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
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 492 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 504 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 4 ms 620 KB Output is correct
8 Correct 3 ms 620 KB Output is correct
9 Correct 4 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 5 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 4 ms 620 KB Output is correct
19 Correct 5 ms 620 KB Output is correct
20 Correct 5 ms 620 KB Output is correct
21 Correct 5 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 492 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 504 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 4 ms 620 KB Output is correct
8 Correct 3 ms 620 KB Output is correct
9 Correct 4 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 5 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 4 ms 620 KB Output is correct
19 Correct 5 ms 620 KB Output is correct
20 Correct 5 ms 620 KB Output is correct
21 Correct 5 ms 620 KB Output is correct
22 Runtime error 25 ms 1132 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Halted 0 ms 0 KB -