답안 #419999

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
419999 2021-06-07T21:31:17 Z ScarletS Nautilus (BOI19_nautilus) C++17
66 / 100
1000 ms 588 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 505, K = 5005;
bitset<N> dp[2][N];
char c[N][N];
string s;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    for (int i=1;i<=n;++i)
        for (int j=1;j<=m;++j)
        {
            cin>>c[i][j];
            dp[0][i][j]=(c[i][j]=='.');
        }
    cin>>s;
    for (auto x : s)
    {
        for (int i=1;i<=n;++i)
            for (int j=1;j<=m;++j)
            {
                if (c[i][j]=='#')
                    dp[1][i][j]=0;
                else if (x=='N')
                    dp[1][i][j]=dp[0][i+1][j];
                else if (x=='S')
                    dp[1][i][j]=dp[0][i-1][j];
                else if (x=='E')
                    dp[1][i][j]=dp[0][i][j-1];
                else if (x=='W')
                    dp[1][i][j]=dp[0][i][j+1];
                else
                    dp[1][i][j]=(dp[0][i+1][j]|dp[0][i-1][j]|dp[0][i][j-1]|dp[0][i][j+1]);
            }
        for (int i=1;i<=n;++i)
            for (int j=1;j<=m;++j)
                dp[0][i][j]=dp[1][i][j];
    }
    int ans = 0;
    for (int i=1;i<=n;++i)
        ans+=dp[0][i].count();
    cout<<ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 332 KB Output is correct
2 Correct 9 ms 332 KB Output is correct
3 Correct 12 ms 332 KB Output is correct
4 Correct 10 ms 332 KB Output is correct
5 Correct 8 ms 332 KB Output is correct
6 Correct 8 ms 396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 332 KB Output is correct
2 Correct 9 ms 332 KB Output is correct
3 Correct 12 ms 332 KB Output is correct
4 Correct 10 ms 332 KB Output is correct
5 Correct 8 ms 332 KB Output is correct
6 Correct 8 ms 396 KB Output is correct
7 Correct 8 ms 392 KB Output is correct
8 Correct 11 ms 332 KB Output is correct
9 Correct 10 ms 392 KB Output is correct
10 Correct 8 ms 392 KB Output is correct
11 Correct 7 ms 392 KB Output is correct
12 Correct 9 ms 396 KB Output is correct
13 Correct 9 ms 392 KB Output is correct
14 Correct 10 ms 328 KB Output is correct
15 Correct 8 ms 388 KB Output is correct
16 Correct 7 ms 332 KB Output is correct
17 Correct 10 ms 332 KB Output is correct
18 Correct 9 ms 332 KB Output is correct
19 Correct 9 ms 392 KB Output is correct
20 Correct 8 ms 332 KB Output is correct
21 Correct 7 ms 388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 332 KB Output is correct
2 Correct 9 ms 332 KB Output is correct
3 Correct 12 ms 332 KB Output is correct
4 Correct 10 ms 332 KB Output is correct
5 Correct 8 ms 332 KB Output is correct
6 Correct 8 ms 396 KB Output is correct
7 Correct 8 ms 392 KB Output is correct
8 Correct 11 ms 332 KB Output is correct
9 Correct 10 ms 392 KB Output is correct
10 Correct 8 ms 392 KB Output is correct
11 Correct 7 ms 392 KB Output is correct
12 Correct 9 ms 396 KB Output is correct
13 Correct 9 ms 392 KB Output is correct
14 Correct 10 ms 328 KB Output is correct
15 Correct 8 ms 388 KB Output is correct
16 Correct 7 ms 332 KB Output is correct
17 Correct 10 ms 332 KB Output is correct
18 Correct 9 ms 332 KB Output is correct
19 Correct 9 ms 392 KB Output is correct
20 Correct 8 ms 332 KB Output is correct
21 Correct 7 ms 388 KB Output is correct
22 Execution timed out 1089 ms 588 KB Time limit exceeded
23 Halted 0 ms 0 KB -