| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1367112 | nataliaa | Nautilus (BOI19_nautilus) | C++20 | 2 ms | 344 KiB |
#include<bits/stdc++.h>
using namespace std;
int n, m, k;
string s;
char a[105][105];
int check(int i, int j, int idx){
if(a[i][j]=='#') return 0;
if(idx==k) return 1;
if(s[idx]=='N'){
if(i==0) return 0;
return check(i-1, j, idx+1);
}
if(s[idx]=='E'){
if(j==m-1) return 0;
return check(i, j+1, idx+1);
}
if(s[idx]=='S'){
if(i==n-1) return 0;
return check(i+1, j, idx+1);
}
if(s[idx]=='W'){
if(j==0) return 0;
return check(i, j-1, idx+1);
}
}
int main(){
cin >> n >> m >> k;;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> a[i][j];
}
}
cin >> s;
int ans = 0;
// cout << check(1, 6, 0)<<endl;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
// if(check(i,j,0)==1) cout << i <<' '<< j <<endl;
ans+=check(i, j, 0);
}
}
cout << ans;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
