답안 #888065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
888065 2023-12-15T22:02:06 Z vjudge1 Nautilus (BOI19_nautilus) C++17
0 / 100
1 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
bitset<512> tmp[502],grd[502],pos[502];
int main() {
    freopen("piepie.in", "r", stdin);
    int r, c, m;
    cin >> r >> c >> m;
    for(int i = 1; i <= r; i++) {
        for(int j = 1; j <= c; j++) {
            char c = getchar();
            if(j==1)
                c=getchar();
            grd[i][j]=(c=='.');
        }
        pos[i]=grd[i];
    }
    for(int i = 0; i < m; i++) {
        char c = getchar();
        if(!i) c=getchar();
        for(int j = 1; j <= r; j++)
            tmp[j]=pos[j], pos[j].reset();
        for(int j = 1; j <= r; j++) {
            if(c=='N'||c=='?')
                pos[j]|=tmp[j+1];
            if(c=='S'||c=='?')
                pos[j]|=tmp[j-1];
            if(c=='E'||c=='?')
                pos[j]|=tmp[j]<<1;
            if(c=='W'||c=='?')
                pos[j]|=tmp[j]>>1;
            pos[j]&=grd[j];
        }
    }
    int ans = 0;
    for(int i = 1; i <= r; i++)
        ans+=pos[i].count();
    cout << ans << '\n';
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:5:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     freopen("piepie.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -