# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
719587 | jamezzz | Nautilus (BOI19_nautilus) | C++17 | 1085 ms | 3412 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf
#define INF 1023456789
#define maxn 505
int r,c,m,grid[maxn][maxn],pos[maxn][maxn],pos2[maxn][maxn];
int main(){
sf("%d%d%d",&r,&c,&m);
for(int i=1;i<=r;++i){
for(int j=1;j<=c;++j){
char ch;sf(" %c",&ch);
if(ch=='.'){
grid[i][j]=1;
pos[i][j]=1;
}
}
}
for(int i=0;i<m;++i){
char ch;sf(" %c",&ch);
vector<pair<int,int>> dir;
if(ch=='W'||ch=='?')dir.push_back({0,1});
if(ch=='E'||ch=='?')dir.push_back({0,-1});
if(ch=='N'||ch=='?')dir.push_back({1,0});
if(ch=='S'||ch=='?')dir.push_back({-1,0});
for(int i=1;i<=r;++i){
for(int j=1;j<=c;++j){
pos2[i][j]=0;
for(auto[dx,dy]:dir){
if(grid[i][j]&&pos[i+dx][j+dy]){
pos2[i][j]=1;
}
}
}
}
for(int i=1;i<=r;++i){
for(int j=1;j<=c;++j)pos[i][j]=pos2[i][j];
}
/*
printf("\n");
for(int i=1;i<=r;++i){
for(int j=1;j<=c;++j)printf("%d",pos[i][j]);
printf("\n");
}
printf("\n");
*/
}
int ans=0;
for(int i=1;i<=r;++i){
for(int j=1;j<=c;++j)ans+=pos[i][j];
}
printf("%d\n",ans);
}
/*
5 9 7
...##....
..#.##..#
..#....##
.##...#..
....#....
WS?EE??
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |