Submission #719189

# Submission time Handle Problem Language Result Execution time Memory
719189 2023-04-05T15:32:24 Z hqminhuwu Nautilus (BOI19_nautilus) C++14
0 / 100
1 ms 1364 KB
#include <bits/stdc++.h>
#define st first
#define nd second
#define ll long long
#define ull unsigned long long
#define pii pair <int,int>
#define pll pair <ll,ll>
#define piii pair <int,pii>
#define vi vector <int>
#define pb push_back
#define mp make_pair
#define forr(_a,_b,_c) for(int _a = _b; _a <= _c; ++_a)
#define ford(_a,_b,_c) for(int _a = (_b) + 1; _a --> _c;)
#define forf(_a,_b,_c) for(int _a = _b; _a < _c; ++_a)
#define all(x) begin(x),end(x)
#define file "test"

using namespace std;
const int N=2e5 + 5;
const ll oo = 1e9;
bitset <502> bit[502],f[5002][502];
int r,c,M;
string a[505],m;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> r >> c >> M;
    forf (i,0,r)
        cin >> a[i];
    cin >> m;
    m = '*' + m;
    forf (i,0,r)
    forf (j,0,c)
        if (a[i][j] == '.')
            bit[i] |= (1 << (c - j - 1));
    forf (i,0,r)
        f[0][i] = (bit[i]);
    forr (i,1,M)
    {
        //cout << m[i] << endl;
        forf (j,0,r)
        {
            if (m[i] == 'W')
                f[i][j] = (f[i-1][j] << 1) & f[0][j];
            if (m[i] == 'E')
                f[i][j] = (f[i-1][j] >> 1) & f[0][j];
            if (m[i] == 'N' && j < r - 1)
                f[i][j] = f[i-1][j+1] & f[0][j];
            if (m[i] == 'S' && j != 0)
                f[i][j] = f[i-1][j - 1] & f[0][j];
            if (m[i] == '?')
                f[i][j] = ((f[i-1][j] << 1) | (f[i-1][j] >> 1) | f[i-1][j+1] | f[i-1][j - 1]) & f[0][j];
            //cout << f[i][j] << endl;
        }
        //cout << endl;
    }
    int ans = 0;
    forf (i,0,r)
        ans += f[M][i].count();
    cout << ans;
    return 0;
}
/*



*/

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1364 KB Output isn't correct
2 Halted 0 ms 0 KB -