답안 #206762

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206762 2020-03-05T06:57:44 Z DodgeBallMan Nautilus (BOI19_nautilus) C++14
66 / 100
118 ms 740 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];
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 6 ms 376 KB Output is correct
4 Correct 6 ms 380 KB Output is correct
5 Correct 5 ms 380 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 6 ms 376 KB Output is correct
4 Correct 6 ms 380 KB Output is correct
5 Correct 5 ms 380 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 7 ms 376 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 7 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 7 ms 376 KB Output is correct
20 Correct 6 ms 380 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 6 ms 376 KB Output is correct
4 Correct 6 ms 380 KB Output is correct
5 Correct 5 ms 380 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 7 ms 376 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 7 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 7 ms 376 KB Output is correct
20 Correct 6 ms 380 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Incorrect 118 ms 740 KB Output isn't correct
23 Halted 0 ms 0 KB -