답안 #206765

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206765 2020-03-05T07:03:36 Z DodgeBallMan Nautilus (BOI19_nautilus) C++14
100 / 100
189 ms 760 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 5e2 + 10;
int r, c, k, ans;
bitset<N> dp[N], a[N];
char s[N*10];
int main()
{
    scanf("%d %d %d",&r,&c,&k);
    for( int i = 0 ; i < r ; i++ ) {
        char t[N];
        scanf("%s",t);
        for( int j = 0 ; j < c ; j++ ) {
            dp[i][j] = a[i][j] = ( t[j] == '.' );
        }
    }
    scanf("%s",s);
    for( int i = 0 ; i < k ; i++ ) {
        bitset<N> tmp[N];
        for( int j = 0 ; j < r ; j++ ) tmp[j].reset();
        if( s[i] == 'S' || s[i] == '?' ) for( int j = 1 ; j < r ; j++ ) tmp[j] |= dp[j-1];
        if( s[i] == 'N' || s[i] == '?' ) for( int j = 0 ; j < r - 1 ; j++ ) tmp[j] |= dp[j+1];
        if( s[i] == 'W' || s[i] == '?' ) for( int j = 0 ; j < r ; j++ ) tmp[j] |= dp[j] >> 1;
        if( s[i] == 'E' || s[i] == '?' ) for( int j = 0 ; j < r ; j++ ) tmp[j] |= dp[j] << 1;

        for( int j = 0 ; j < r ; j++ ) dp[j] = tmp[j] & a[j];
    }
    for( int i = 0 ; i < r ; i++ ) ans += dp[i].count();
    printf("%d",ans);
    return 0;
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d",&r,&c,&k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",t);
         ~~~~~^~~~~~~~
nautilus.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",s);
     ~~~~~^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 380 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 380 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 6 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 6 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 380 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 6 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 6 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 117 ms 632 KB Output is correct
23 Correct 118 ms 632 KB Output is correct
24 Correct 115 ms 632 KB Output is correct
25 Correct 114 ms 632 KB Output is correct
26 Correct 116 ms 632 KB Output is correct
27 Correct 161 ms 708 KB Output is correct
28 Correct 157 ms 632 KB Output is correct
29 Correct 156 ms 632 KB Output is correct
30 Correct 159 ms 704 KB Output is correct
31 Correct 158 ms 632 KB Output is correct
32 Correct 186 ms 632 KB Output is correct
33 Correct 184 ms 632 KB Output is correct
34 Correct 189 ms 632 KB Output is correct
35 Correct 188 ms 632 KB Output is correct
36 Correct 188 ms 760 KB Output is correct