Submission #857145

# Submission time Handle Problem Language Result Execution time Memory
857145 2023-10-05T12:43:13 Z Trisanu_Das Nautilus (BOI19_nautilus) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int r, c, m, ans;
char a[r][c];
string s;

void paths(int x, int y, int far){
  if(x < 0 || x >= r || y < 0 || y >= c || a[x][y] == '#') return;
  if(far == q){
    ans++; return;
  }
  if(s[far] == 'N') paths(x - 1, y, far + 1);
  if(s[far] == 'S') paths(x + 1, y, far + 1);
  if(s[far] == 'W') paths(x, y - 1, far + 1);
  if(s[far] == 'E') paths(x, y + 1, far + 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] != '#') paths(i, j, 0);
  cout << ans << '\n';
}

Compilation message

nautilus.cpp:5:9: error: array bound is not an integer constant before ']' token
    5 | char a[r][c];
      |         ^
nautilus.cpp:5:12: error: array bound is not an integer constant before ']' token
    5 | char a[r][c];
      |            ^
nautilus.cpp: In function 'void paths(int, int, int)':
nautilus.cpp:9:44: error: 'a' was not declared in this scope
    9 |   if(x < 0 || x >= r || y < 0 || y >= c || a[x][y] == '#') return;
      |                                            ^
nautilus.cpp:10:13: error: 'q' was not declared in this scope
   10 |   if(far == q){
      |             ^
nautilus.cpp: In function 'int main()':
nautilus.cpp:21:64: error: 'a' was not declared in this scope
   21 |   for(int i = 0; i < r; i++) for(int j = 0; j < c; j++) cin >> a[i][j];
      |                                                                ^
nautilus.cpp:23:60: error: 'a' was not declared in this scope
   23 |   for(int i = 0; i < r; i++) for(int j = 0; j < c; j++) if(a[i][j] != '#') paths(i, j, 0);
      |                                                            ^