제출 #206762

#제출 시각아이디문제언어결과실행 시간메모리
206762DodgeBallManNautilus (BOI19_nautilus)C++14
66 / 100
118 ms740 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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);
     ~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...