답안 #927505

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
927505 2024-02-15T02:22:50 Z Sir_Ahmed_Imran Nautilus (BOI19_nautilus) C++17
66 / 100
10 ms 2652 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 102
char a[N][N];
bool dp[N][N][N];
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>>a[i][j];
            dp[i][j][0]=(a[i][j]=='.');
        }
    }
    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(a[i][j]=='#') 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1372 KB Output is correct
2 Correct 4 ms 1500 KB Output is correct
3 Correct 5 ms 1372 KB Output is correct
4 Correct 5 ms 1372 KB Output is correct
5 Correct 3 ms 1496 KB Output is correct
6 Correct 2 ms 1392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1372 KB Output is correct
2 Correct 4 ms 1500 KB Output is correct
3 Correct 5 ms 1372 KB Output is correct
4 Correct 5 ms 1372 KB Output is correct
5 Correct 3 ms 1496 KB Output is correct
6 Correct 2 ms 1392 KB Output is correct
7 Correct 3 ms 1500 KB Output is correct
8 Correct 7 ms 1496 KB Output is correct
9 Correct 7 ms 1372 KB Output is correct
10 Correct 3 ms 1372 KB Output is correct
11 Correct 1 ms 1372 KB Output is correct
12 Correct 3 ms 1372 KB Output is correct
13 Correct 8 ms 1368 KB Output is correct
14 Correct 10 ms 1476 KB Output is correct
15 Correct 3 ms 1372 KB Output is correct
16 Correct 1 ms 1372 KB Output is correct
17 Correct 5 ms 1372 KB Output is correct
18 Correct 6 ms 1372 KB Output is correct
19 Correct 8 ms 1492 KB Output is correct
20 Correct 3 ms 1368 KB Output is correct
21 Correct 2 ms 1372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1372 KB Output is correct
2 Correct 4 ms 1500 KB Output is correct
3 Correct 5 ms 1372 KB Output is correct
4 Correct 5 ms 1372 KB Output is correct
5 Correct 3 ms 1496 KB Output is correct
6 Correct 2 ms 1392 KB Output is correct
7 Correct 3 ms 1500 KB Output is correct
8 Correct 7 ms 1496 KB Output is correct
9 Correct 7 ms 1372 KB Output is correct
10 Correct 3 ms 1372 KB Output is correct
11 Correct 1 ms 1372 KB Output is correct
12 Correct 3 ms 1372 KB Output is correct
13 Correct 8 ms 1368 KB Output is correct
14 Correct 10 ms 1476 KB Output is correct
15 Correct 3 ms 1372 KB Output is correct
16 Correct 1 ms 1372 KB Output is correct
17 Correct 5 ms 1372 KB Output is correct
18 Correct 6 ms 1372 KB Output is correct
19 Correct 8 ms 1492 KB Output is correct
20 Correct 3 ms 1368 KB Output is correct
21 Correct 2 ms 1372 KB Output is correct
22 Runtime error 2 ms 2652 KB Execution killed with signal 11
23 Halted 0 ms 0 KB -