Submission #889815

#TimeUsernameProblemLanguageResultExecution timeMemory
889815vjudge1Nautilus (BOI19_nautilus)C++17
29 / 100
10 ms488 KiB
#include <bits/stdc++.h> using namespace std; int r, c, m, ans; char a[501][501]; string s; void rec(int x, int y, int d){ if(x<0 || x>=r || y<0 || y>=c || a[x][y]=='#'){ return; } if(d==m){ ans++; return; } if(s[d]=='N'){ rec(x-1, y, d+1); } if(s[d]=='S'){ rec(x+1, y, d+1); } if(s[d]=='W'){ rec(x, y-1, d+1); } if(s[d]=='E'){ rec(x, y+1, d+1); } } int main(){ cin >> r >> c >> m; for(int i=0; i<r; i++){ for(int j=0; j<c; j++){ cin>>a[i][j]; } } cin>>s; for(int i=0; i < r; i++){ for(int j = 0; j < c; j++){ if(a[i][j]!='#'){ rec(i, j, 0); } } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...