Submission #513816

# Submission time Handle Problem Language Result Execution time Memory
513816 2022-01-17T16:36:00 Z stefantaga Nautilus (BOI19_nautilus) C++14
66 / 100
273 ms 26176 KB
#include <bits/stdc++.h>

using namespace std;
bitset <501> din[501][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;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1608 KB Output is correct
2 Correct 4 ms 1604 KB Output is correct
3 Correct 4 ms 1612 KB Output is correct
4 Correct 5 ms 1608 KB Output is correct
5 Correct 4 ms 1612 KB Output is correct
6 Correct 4 ms 1612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1608 KB Output is correct
2 Correct 4 ms 1604 KB Output is correct
3 Correct 4 ms 1612 KB Output is correct
4 Correct 5 ms 1608 KB Output is correct
5 Correct 4 ms 1612 KB Output is correct
6 Correct 4 ms 1612 KB Output is correct
7 Correct 7 ms 1556 KB Output is correct
8 Correct 5 ms 1612 KB Output is correct
9 Correct 5 ms 1612 KB Output is correct
10 Correct 5 ms 1612 KB Output is correct
11 Correct 5 ms 1608 KB Output is correct
12 Correct 6 ms 1612 KB Output is correct
13 Correct 5 ms 1612 KB Output is correct
14 Correct 7 ms 1612 KB Output is correct
15 Correct 5 ms 1608 KB Output is correct
16 Correct 5 ms 1612 KB Output is correct
17 Correct 5 ms 1584 KB Output is correct
18 Correct 5 ms 1612 KB Output is correct
19 Correct 7 ms 1612 KB Output is correct
20 Correct 5 ms 1584 KB Output is correct
21 Correct 5 ms 1612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1608 KB Output is correct
2 Correct 4 ms 1604 KB Output is correct
3 Correct 4 ms 1612 KB Output is correct
4 Correct 5 ms 1608 KB Output is correct
5 Correct 4 ms 1612 KB Output is correct
6 Correct 4 ms 1612 KB Output is correct
7 Correct 7 ms 1556 KB Output is correct
8 Correct 5 ms 1612 KB Output is correct
9 Correct 5 ms 1612 KB Output is correct
10 Correct 5 ms 1612 KB Output is correct
11 Correct 5 ms 1608 KB Output is correct
12 Correct 6 ms 1612 KB Output is correct
13 Correct 5 ms 1612 KB Output is correct
14 Correct 7 ms 1612 KB Output is correct
15 Correct 5 ms 1608 KB Output is correct
16 Correct 5 ms 1612 KB Output is correct
17 Correct 5 ms 1584 KB Output is correct
18 Correct 5 ms 1612 KB Output is correct
19 Correct 7 ms 1612 KB Output is correct
20 Correct 5 ms 1584 KB Output is correct
21 Correct 5 ms 1612 KB Output is correct
22 Runtime error 273 ms 26176 KB Execution killed with signal 11
23 Halted 0 ms 0 KB -