Submission #513819

# Submission time Handle Problem Language Result Execution time Memory
513819 2022-01-17T16:41:53 Z stefantaga Nautilus (BOI19_nautilus) C++14
100 / 100
159 ms 157344 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
bitset <502> din[502][5005];
bitset <502> sea[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++)
        {
               if (sal[k]=='S')
               {
                   din[i][k] = din[i-1][k-1] & sea[i];
               }
               else
               if (sal[k]=='E')
               {
                   din[i][k] = (din[i][k-1] << 1) & sea[i];
               }
               else
               if (sal[k]=='N')
               {
                   din[i][k] = din[i+1][k-1] & sea[i];
               }
               else
               if (sal[k]=='W')
               {
                   din[i][k] = (din[i][k-1] >>1) & sea[i];
               }
               else
               {
                   din[i][k] = (din[i+1][k-1] | (din[i][k-1]<<1) | din[i-1][k-1] | (din[i][k-1]>>1) ) & sea[i];
               }
        }
    }
    for (i=1;i<=n;i++)
    {
        sum=sum+din[i][t].count();
    }
    cout<<sum;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 1 ms 1356 KB Output is correct
4 Correct 1 ms 1356 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 1 ms 1356 KB Output is correct
4 Correct 1 ms 1356 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1356 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 1 ms 1356 KB Output is correct
15 Correct 1 ms 1356 KB Output is correct
16 Correct 1 ms 1356 KB Output is correct
17 Correct 1 ms 1356 KB Output is correct
18 Correct 1 ms 1356 KB Output is correct
19 Correct 1 ms 1356 KB Output is correct
20 Correct 1 ms 1312 KB Output is correct
21 Correct 1 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 1 ms 1356 KB Output is correct
4 Correct 1 ms 1356 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1356 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 1 ms 1356 KB Output is correct
15 Correct 1 ms 1356 KB Output is correct
16 Correct 1 ms 1356 KB Output is correct
17 Correct 1 ms 1356 KB Output is correct
18 Correct 1 ms 1356 KB Output is correct
19 Correct 1 ms 1356 KB Output is correct
20 Correct 1 ms 1312 KB Output is correct
21 Correct 1 ms 1356 KB Output is correct
22 Correct 113 ms 157020 KB Output is correct
23 Correct 106 ms 157256 KB Output is correct
24 Correct 100 ms 157252 KB Output is correct
25 Correct 99 ms 157264 KB Output is correct
26 Correct 98 ms 157188 KB Output is correct
27 Correct 111 ms 157212 KB Output is correct
28 Correct 100 ms 157284 KB Output is correct
29 Correct 103 ms 157252 KB Output is correct
30 Correct 111 ms 157344 KB Output is correct
31 Correct 123 ms 157188 KB Output is correct
32 Correct 107 ms 157276 KB Output is correct
33 Correct 111 ms 157292 KB Output is correct
34 Correct 107 ms 157252 KB Output is correct
35 Correct 159 ms 157228 KB Output is correct
36 Correct 103 ms 157256 KB Output is correct