| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 328827 | egas | Nautilus (BOI19_nautilus) | C++14 | 22 ms | 3308 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int r;
    cin >> r;
    int c;
    cin >> c;
    int m;
    cin >> m;
    vector<string> grid;
    for(int i = 0 ; i < r ; i++) {
        string temp;
        cin >> temp;
        grid.push_back(temp);
    }
    string path;
    cin >> path;
    bool canVisit[101][101][101];
    memset(canVisit,0,sizeof canVisit);
    int res=0;
    for(int i = 0 ; i < r ; i++) {
        for(int j = 0 ; j < c ; j++) {
            if(grid[i][j]=='.') {
                canVisit[i][j][0]=true;
            }
        }
    }
    for(int k=0; k<path.length(); k++) {
        if(path[k]=='S') {
            for(int i = 0 ; i < r ; i++) {
                for(int j = 0 ; j < c ; j++) {
                    if(i-1>=0 and canVisit[i-1][j][k] and grid[i][j]=='.') {
                        canVisit[i][j][k+1]=1;
                    }
                }
            }
        } else if(path[k]=='N') {
            for(int i = 0 ; i < r ; i++) {
                for(int j = 0 ; j < c ; j++) {
                    if(i+1<r and canVisit[i+1][j][k] and grid[i][j]=='.') {
                        canVisit[i][j][k+1]=1;
                    }
                }
            }
        } else if(path[k]=='E') {
            for(int i = 0 ; i < r ; i++) {
                for(int j = 0 ; j < c ; j++) {
                    if(j-1>=0 and canVisit[i][j-1][k] and grid[i][j]=='.') {
                        canVisit[i][j][k+1]=1;
                    }
                }
            }
        } else if(path[k]=='W') {
            for(int i = 0 ; i < r ; i++) {
                for(int j = 0 ; j < c ; j++) {
                    if(j+1<c and canVisit[i][j+1][k] and grid[i][j]=='.') {
                        canVisit[i][j][k+1]=1;
                    }
                }
            }
        } else {
            for(int i = 0 ; i < r ; i++) {
                for(int j = 0 ; j < c ; j++) {
                    if(i-1>=0 and canVisit[i-1][j][k] and grid[i][j]=='.') {
                        canVisit[i][j][k+1]=1;
                    }
                    if(i+1<r and canVisit[i+1][j][k] and grid[i][j]=='.') {
                        canVisit[i][j][k+1]=1;
                    }
                    if(j+1<c and canVisit[i][j+1][k] and grid[i][j]=='.') {
                        canVisit[i][j][k+1]=1;
                    }
                    if(j-1>=0 and canVisit[i][j-1][k] and grid[i][j]=='.') {
                        canVisit[i][j][k+1]=1;
                    }
                }
            }
        }
    }
    for(int i = 0 ; i < r ; i++) {
        for(int j = 0 ; j < c ; j++) {
            res+=canVisit[i][j][path.length()];
        }
    }
    cout << res << '\n';
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
