답안 #513817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
513817 2022-01-17T16:36:53 Z stefantaga Nautilus (BOI19_nautilus) C++14
66 / 100
1000 ms 41064 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
bitset <502> din[502][5005];
int sea[505][505];
char sal[5005],ch;
int sum,i,j,n,t,m,k;
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    #ifdef HOME
    ifstream cin("date.in");
    ofstream cout("date.out");
    #endif // HOME
    cin>> n >> m >> t;
    for (i=1;i<=n;i++)
    {
        for (j=1;j<=m;j++)
        {
            cin>>ch;
            if (ch=='#')
            {
                sea[i][j]=0;
                din[i][0][j]=0;
            }
            else
            {
                sea[i][j]=1;
                din[i][0][j]=1;
            }
        }
    }
    cin>>(sal+1);
    for (k=1;k<=t;k++)
    {
        for (i=1;i<=n;i++)
        {
            for (j=1;j<=m;j++)
            {
               if (sal[k]=='S')
               {
                   din[i][k][j] = din[i-1][k-1][j] & sea[i][j];
               }
               else
               if (sal[k]=='E')
               {
                   din[i][k][j] = din[i][k-1][j-1] & sea[i][j];
               }
               else
               if (sal[k]=='N')
               {
                   din[i][k][j] = din[i+1][k-1][j] & sea[i][j];
               }
               else
               if (sal[k]=='W')
               {
                   din[i][k][j] = din[i][k-1][j+1] & sea[i][j];
               }
               else
               {
                   din[i][k][j] = (din[i+1][k-1][j] | din[i][k-1][j-1] | din[i-1][k-1][j] | din[i][k-1][j+1] ) & sea[i][j];
               }
            }
        }
    }
    for (i=1;i<=n;i++)
    {
        for (j=1;j<=m;j++)
        {
            sum=sum+din[i][t][j];
        }
    }
    cout<<sum;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1612 KB Output is correct
2 Correct 4 ms 1612 KB Output is correct
3 Correct 4 ms 1564 KB Output is correct
4 Correct 5 ms 1608 KB Output is correct
5 Correct 7 ms 1612 KB Output is correct
6 Correct 5 ms 1612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1612 KB Output is correct
2 Correct 4 ms 1612 KB Output is correct
3 Correct 4 ms 1564 KB Output is correct
4 Correct 5 ms 1608 KB Output is correct
5 Correct 7 ms 1612 KB Output is correct
6 Correct 5 ms 1612 KB Output is correct
7 Correct 5 ms 1612 KB Output is correct
8 Correct 5 ms 1612 KB Output is correct
9 Correct 5 ms 1524 KB Output is correct
10 Correct 6 ms 1612 KB Output is correct
11 Correct 6 ms 1612 KB Output is correct
12 Correct 8 ms 1616 KB Output is correct
13 Correct 5 ms 1612 KB Output is correct
14 Correct 6 ms 1572 KB Output is correct
15 Correct 5 ms 1524 KB Output is correct
16 Correct 8 ms 1612 KB Output is correct
17 Correct 6 ms 1616 KB Output is correct
18 Correct 6 ms 1612 KB Output is correct
19 Correct 5 ms 1612 KB Output is correct
20 Correct 9 ms 1612 KB Output is correct
21 Correct 7 ms 1612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1612 KB Output is correct
2 Correct 4 ms 1612 KB Output is correct
3 Correct 4 ms 1564 KB Output is correct
4 Correct 5 ms 1608 KB Output is correct
5 Correct 7 ms 1612 KB Output is correct
6 Correct 5 ms 1612 KB Output is correct
7 Correct 5 ms 1612 KB Output is correct
8 Correct 5 ms 1612 KB Output is correct
9 Correct 5 ms 1524 KB Output is correct
10 Correct 6 ms 1612 KB Output is correct
11 Correct 6 ms 1612 KB Output is correct
12 Correct 8 ms 1616 KB Output is correct
13 Correct 5 ms 1612 KB Output is correct
14 Correct 6 ms 1572 KB Output is correct
15 Correct 5 ms 1524 KB Output is correct
16 Correct 8 ms 1612 KB Output is correct
17 Correct 6 ms 1616 KB Output is correct
18 Correct 6 ms 1612 KB Output is correct
19 Correct 5 ms 1612 KB Output is correct
20 Correct 9 ms 1612 KB Output is correct
21 Correct 7 ms 1612 KB Output is correct
22 Execution timed out 1088 ms 41064 KB Time limit exceeded
23 Halted 0 ms 0 KB -