Submission #651290

#TimeUsernameProblemLanguageResultExecution timeMemory
651290KenparNautilus (BOI19_nautilus)C++17
0 / 100
4 ms340 KiB
#include "bits/stdc++.h" using namespace std; #define UPLOAD #define ll long long #define endl '\n' const ll MOD = 998244353; const ll INF = 1e16; const ll MAX = 1e5+1; int n,m,c; vector<vector<int>> moves(200, vector<int>(2)); bool checkValid(int a, int b){ return (b >= 0 && a < n) && (b >= 0 && b < m); } void solve(){ cin>>n>>m>>c; moves['W'] = {0, -1}; moves['S'] = {1, 0}; moves['N'] = {-1, 0}; moves['E'] = {0, 1}; bool arr[n][m]; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ char temp; cin>>temp; arr[i][j] = temp == '.'; } } bool temp[n][m]; for(int x = 0; x < c; x++){ char command; cin>>command; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ bool ans = false; if(command == '?'){ for(char cur : "WSEN"){ ans = checkValid(i + moves[command][0], j + moves[command][1]); if(ans){ ans = arr[i + moves[command][0]][j + moves[command][1]]; } if(ans) break; } }else{ ans = checkValid(i + moves[command][0], j + moves[command][1]); if(ans){ ans = arr[i + moves[command][0]][j + moves[command][1]]; } } temp[i][j] = ans; } } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ arr[i][j] = temp[i][j]; } } } int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ ans+= arr[i][j]; } } cout<<ans; } int main() { cin.tie(NULL); ios::sync_with_stdio(NULL); int t = 1; //cin >> t; while(t--){ //cout<<"----------"<<endl; solve(); cout<<endl; } }

Compilation message (stderr)

nautilus.cpp: In function 'void solve()':
nautilus.cpp:42:15: warning: unused variable 'cur' [-Wunused-variable]
   42 |      for(char cur : "WSEN"){
      |               ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...