답안 #211524

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
211524 2020-03-20T16:49:04 Z Nnandi Nautilus (BOI19_nautilus) C++14
66 / 100
324 ms 50424 KB
#include <bits/stdc++.h>
using namespace std;

const int maxrc = 500;
const int maxn = 100;

bool dp[maxrc][maxrc][maxn];
bool tab[maxrc][maxrc];
int r, c, m;
string dir;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>r>>c>>m;
    for(int i=1;i<=r;i++) {
        for(int j=1;j<=c;j++) {
            char z;
            cin>>z;
            tab[i][j] = (z != '#');
            dp[i][j][m] = (z != '#');
        }
    }
    cin>>dir;
    reverse(dir.begin(),dir.end());
    int sol = 0;
    for(int k=m-1;k>=0;k--) {
       for(int i=1;i<=r;i++) {
            for(int j=1;j<=c;j++) {
                map<char,bool> most;
                most['S'] = dp[i-1][j][k+1];
                most['N'] = dp[i+1][j][k+1];
                most['W'] = dp[i][j+1][k+1];
                most['E'] = dp[i][j-1][k+1];
                most['?'] = most['N'] || most['S'] || most['E'] || most['W'];
                dp[i][j][k] = (most[dir[k]] && tab[i][j]);
                if(k == 0 && dp[i][j][k]) sol++;
            }
        }
    }
    cout<<sol<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 267 ms 1792 KB Output is correct
2 Correct 291 ms 1912 KB Output is correct
3 Correct 280 ms 1792 KB Output is correct
4 Correct 277 ms 1824 KB Output is correct
5 Correct 276 ms 1792 KB Output is correct
6 Correct 271 ms 1792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 267 ms 1792 KB Output is correct
2 Correct 291 ms 1912 KB Output is correct
3 Correct 280 ms 1792 KB Output is correct
4 Correct 277 ms 1824 KB Output is correct
5 Correct 276 ms 1792 KB Output is correct
6 Correct 271 ms 1792 KB Output is correct
7 Correct 273 ms 1888 KB Output is correct
8 Correct 282 ms 1792 KB Output is correct
9 Correct 278 ms 1824 KB Output is correct
10 Correct 286 ms 1912 KB Output is correct
11 Correct 278 ms 1792 KB Output is correct
12 Correct 264 ms 1912 KB Output is correct
13 Correct 278 ms 1792 KB Output is correct
14 Correct 285 ms 1792 KB Output is correct
15 Correct 279 ms 1912 KB Output is correct
16 Correct 279 ms 1828 KB Output is correct
17 Correct 285 ms 1912 KB Output is correct
18 Correct 274 ms 1792 KB Output is correct
19 Correct 324 ms 1792 KB Output is correct
20 Correct 310 ms 1820 KB Output is correct
21 Correct 288 ms 1792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 267 ms 1792 KB Output is correct
2 Correct 291 ms 1912 KB Output is correct
3 Correct 280 ms 1792 KB Output is correct
4 Correct 277 ms 1824 KB Output is correct
5 Correct 276 ms 1792 KB Output is correct
6 Correct 271 ms 1792 KB Output is correct
7 Correct 273 ms 1888 KB Output is correct
8 Correct 282 ms 1792 KB Output is correct
9 Correct 278 ms 1824 KB Output is correct
10 Correct 286 ms 1912 KB Output is correct
11 Correct 278 ms 1792 KB Output is correct
12 Correct 264 ms 1912 KB Output is correct
13 Correct 278 ms 1792 KB Output is correct
14 Correct 285 ms 1792 KB Output is correct
15 Correct 279 ms 1912 KB Output is correct
16 Correct 279 ms 1828 KB Output is correct
17 Correct 285 ms 1912 KB Output is correct
18 Correct 274 ms 1792 KB Output is correct
19 Correct 324 ms 1792 KB Output is correct
20 Correct 310 ms 1820 KB Output is correct
21 Correct 288 ms 1792 KB Output is correct
22 Runtime error 49 ms 50424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Halted 0 ms 0 KB -