답안 #535253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
535253 2022-03-09T19:27:52 Z groshi Nautilus (BOI19_nautilus) C++17
100 / 100
170 ms 1092 KB
#include<iostream>
#include<bitset>
using namespace std;
bitset<600> dp[2][600],usun[600];
char t[600][600];
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int n,m,k;
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>t[i][j];
            if(t[i][j]=='.')
            {
                dp[1][i][j]=1;
                usun[i][j]=1;
            }
        }
    }
    string s;
    cin>>s;
    for(int i=0;i<k;i++)
    {
        for(int j=1;j<=n;j++)
            dp[i%2][j]&=0;
        if(s[i]=='?' || s[i]=='N')
            for(int j=1;j<n;j++)
                dp[i%2][j]|=dp[!(i%2)][j+1];
        if(s[i]=='?' || s[i]=='S')
            for(int j=2;j<=n;j++)
                dp[i%2][j]|=dp[!(i%2)][j-1];
        if(s[i]=='W' || s[i]=='?')
            for(int j=1;j<=n;j++)
                dp[i%2][j]|=(dp[!(i%2)][j]>>1);
        if(s[i]=='E' || s[i]=='?')
            for(int j=1;j<=n;j++)
                dp[i%2][j]|=(dp[!(i%2)][j]<<1);
        for(int j=1;j<=n;j++)
            dp[i%2][j]&=usun[j];
    }
    int wynik=0;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(dp[(k-1)%2][i][j])
                wynik++;
    cout<<wynik;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 92 ms 960 KB Output is correct
23 Correct 95 ms 984 KB Output is correct
24 Correct 91 ms 972 KB Output is correct
25 Correct 90 ms 972 KB Output is correct
26 Correct 87 ms 956 KB Output is correct
27 Correct 135 ms 988 KB Output is correct
28 Correct 145 ms 992 KB Output is correct
29 Correct 136 ms 988 KB Output is correct
30 Correct 137 ms 1080 KB Output is correct
31 Correct 130 ms 976 KB Output is correct
32 Correct 166 ms 1092 KB Output is correct
33 Correct 170 ms 988 KB Output is correct
34 Correct 170 ms 988 KB Output is correct
35 Correct 167 ms 972 KB Output is correct
36 Correct 167 ms 976 KB Output is correct