Submission #210048

# Submission time Handle Problem Language Result Execution time Memory
210048 2020-03-16T13:11:23 Z AlainSu Nautilus (BOI19_nautilus) C++14
100 / 100
190 ms 1404 KB
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9 
using namespace std;
typedef long long ll;
int n, m, k;
string s;
char mat[502][502];
bitset<502 * 502> dp, pos;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    cin >> n >> m >> k;
    for(int i = 1; i <= n; ++i)
        cin >> (mat[i] + 1);
    cin >> s;
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
            if(mat[i][j] != '#')
                dp[(i - 1) * (m + 1) + j] = 1;
    pos = dp;
    for(int i = 0; i < k; ++i)
    {
        if(s[i] == 'E')
            dp = (dp << 1) & pos;
        if(s[i] == 'W')
            dp = (dp >> 1) & pos;
        if(s[i] == 'N')
            dp = (dp >> (m + 1)) & pos;
        if(s[i] == 'S')
            dp = (dp << (m + 1)) & pos;
        if(s[i] == '?')
            dp = ((dp >> 1) | (dp << 1) | (dp >> (m + 1)) | (dp << (m + 1))) & pos;
    }
    cout << dp.count();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 632 KB Output is correct
2 Correct 6 ms 636 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
4 Correct 6 ms 632 KB Output is correct
5 Correct 6 ms 632 KB Output is correct
6 Correct 6 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 632 KB Output is correct
2 Correct 6 ms 636 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
4 Correct 6 ms 632 KB Output is correct
5 Correct 6 ms 632 KB Output is correct
6 Correct 6 ms 632 KB Output is correct
7 Correct 7 ms 888 KB Output is correct
8 Correct 7 ms 888 KB Output is correct
9 Correct 7 ms 892 KB Output is correct
10 Correct 7 ms 888 KB Output is correct
11 Correct 7 ms 888 KB Output is correct
12 Correct 8 ms 888 KB Output is correct
13 Correct 8 ms 888 KB Output is correct
14 Correct 8 ms 888 KB Output is correct
15 Correct 8 ms 888 KB Output is correct
16 Correct 8 ms 888 KB Output is correct
17 Correct 9 ms 760 KB Output is correct
18 Correct 8 ms 760 KB Output is correct
19 Correct 9 ms 760 KB Output is correct
20 Correct 8 ms 760 KB Output is correct
21 Correct 8 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 632 KB Output is correct
2 Correct 6 ms 636 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
4 Correct 6 ms 632 KB Output is correct
5 Correct 6 ms 632 KB Output is correct
6 Correct 6 ms 632 KB Output is correct
7 Correct 7 ms 888 KB Output is correct
8 Correct 7 ms 888 KB Output is correct
9 Correct 7 ms 892 KB Output is correct
10 Correct 7 ms 888 KB Output is correct
11 Correct 7 ms 888 KB Output is correct
12 Correct 8 ms 888 KB Output is correct
13 Correct 8 ms 888 KB Output is correct
14 Correct 8 ms 888 KB Output is correct
15 Correct 8 ms 888 KB Output is correct
16 Correct 8 ms 888 KB Output is correct
17 Correct 9 ms 760 KB Output is correct
18 Correct 8 ms 760 KB Output is correct
19 Correct 9 ms 760 KB Output is correct
20 Correct 8 ms 760 KB Output is correct
21 Correct 8 ms 760 KB Output is correct
22 Correct 91 ms 1272 KB Output is correct
23 Correct 92 ms 1272 KB Output is correct
24 Correct 98 ms 1404 KB Output is correct
25 Correct 89 ms 1276 KB Output is correct
26 Correct 92 ms 1272 KB Output is correct
27 Correct 152 ms 1272 KB Output is correct
28 Correct 140 ms 1272 KB Output is correct
29 Correct 141 ms 1272 KB Output is correct
30 Correct 147 ms 1272 KB Output is correct
31 Correct 147 ms 1272 KB Output is correct
32 Correct 190 ms 1144 KB Output is correct
33 Correct 181 ms 1144 KB Output is correct
34 Correct 175 ms 1144 KB Output is correct
35 Correct 179 ms 1144 KB Output is correct
36 Correct 176 ms 1144 KB Output is correct