# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
729789 | 2023-04-24T14:47:39 Z | vjudge1 | Nautilus (BOI19_nautilus) | C++14 | 1 ms | 340 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int r,c; string m; cin>>r>>c; int mat[r][c]; for(int i=0;i<r;i++) { for(int j=0;j<c;j++) { cin>>mat[i][j]; } } int ans=0; queue<int>Q; for(int i=0;i<r;i++) { for(int j=0;j<c;j++) { if(mat[i][j]=='.')///""; { Q.push(i); Q.push(j); Q.push(0); while(!Q.empty()) { int ti=Q.front();Q.pop(); int tj=Q.front();Q.pop(); int k=Q.front();Q.pop(); if(k==m.size()) { ans++; } else { if(m[k]=='?') { } else { int ci; int cj; if(m[k]=='N') { ci=ti+-1; } else if(m[k]=='S') { ci=ti+1; } else if(m[k]=='W') { cj=tj-1; } else { cj=tj+1; } if(ci<0||cj<0||ci>=r||cj>=c)continue; if(mat[ci][cj]=='#')continue; Q.push(ci); Q.push(cj); Q.push(k+1); } } } } } } cout<<ans<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |