Submission #927511

# Submission time Handle Problem Language Result Execution time Memory
927511 2024-02-15T02:29:29 Z Sir_Ahmed_Imran Nautilus (BOI19_nautilus) C++17
66 / 100
46 ms 262144 KB
                              ///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define append push_back
#define add insert
#define nl "\n"
#define ff first
#define ss second
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL)
#define N 502
#define M 5001
bool dp[N][N][M];
void solve(){
    char r;
    int n,m,o,s;
    cin>>n>>m>>o;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>r;
            dp[i][j][0]=(r=='.');
        }
    }
    s=0;
    for(int k=1;k<=o;k++){
        cin>>r;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                if(!dp[i][j][0]) continue;
                if(r=='?'){
                    if(dp[i+1][j][k-1]) dp[i][j][k]=1;
                    if(dp[i][j-1][k-1]) dp[i][j][k]=1;
                    if(dp[i-1][j][k-1]) dp[i][j][k]=1;
                    if(dp[i][j+1][k-1]) dp[i][j][k]=1;
                }
                if(r=='N' && dp[i+1][j][k-1])
                    dp[i][j][k]=1;
                if(r=='E' && dp[i][j-1][k-1])
                    dp[i][j][k]=1;
                if(r=='S' && dp[i-1][j][k-1])
                    dp[i][j][k]=1;
                if(r=='W' && dp[i][j+1][k-1])
                    dp[i][j][k]=1;
                if(dp[i][j][o]) s++;
            }
        }
    }
    cout<<s;
}
int main(){
    L0TA;
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 46 ms 244560 KB Output is correct
2 Correct 32 ms 244644 KB Output is correct
3 Correct 32 ms 244560 KB Output is correct
4 Correct 32 ms 244560 KB Output is correct
5 Correct 30 ms 244576 KB Output is correct
6 Correct 29 ms 244560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 244560 KB Output is correct
2 Correct 32 ms 244644 KB Output is correct
3 Correct 32 ms 244560 KB Output is correct
4 Correct 32 ms 244560 KB Output is correct
5 Correct 30 ms 244576 KB Output is correct
6 Correct 29 ms 244560 KB Output is correct
7 Correct 31 ms 244564 KB Output is correct
8 Correct 33 ms 244572 KB Output is correct
9 Correct 32 ms 244572 KB Output is correct
10 Correct 30 ms 244572 KB Output is correct
11 Correct 29 ms 244564 KB Output is correct
12 Correct 30 ms 244560 KB Output is correct
13 Correct 33 ms 244676 KB Output is correct
14 Correct 36 ms 244608 KB Output is correct
15 Correct 30 ms 244568 KB Output is correct
16 Correct 29 ms 244560 KB Output is correct
17 Correct 36 ms 244580 KB Output is correct
18 Correct 36 ms 244560 KB Output is correct
19 Correct 35 ms 244572 KB Output is correct
20 Correct 30 ms 244568 KB Output is correct
21 Correct 30 ms 244572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 244560 KB Output is correct
2 Correct 32 ms 244644 KB Output is correct
3 Correct 32 ms 244560 KB Output is correct
4 Correct 32 ms 244560 KB Output is correct
5 Correct 30 ms 244576 KB Output is correct
6 Correct 29 ms 244560 KB Output is correct
7 Correct 31 ms 244564 KB Output is correct
8 Correct 33 ms 244572 KB Output is correct
9 Correct 32 ms 244572 KB Output is correct
10 Correct 30 ms 244572 KB Output is correct
11 Correct 29 ms 244564 KB Output is correct
12 Correct 30 ms 244560 KB Output is correct
13 Correct 33 ms 244676 KB Output is correct
14 Correct 36 ms 244608 KB Output is correct
15 Correct 30 ms 244568 KB Output is correct
16 Correct 29 ms 244560 KB Output is correct
17 Correct 36 ms 244580 KB Output is correct
18 Correct 36 ms 244560 KB Output is correct
19 Correct 35 ms 244572 KB Output is correct
20 Correct 30 ms 244568 KB Output is correct
21 Correct 30 ms 244572 KB Output is correct
22 Runtime error 34 ms 262144 KB Execution killed with signal 9
23 Halted 0 ms 0 KB -