Submission #857151

# Submission time Handle Problem Language Result Execution time Memory
857151 2023-10-05T12:58:45 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[500][500];
string s;
int dp[500][500][5000];
 
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
 
void paths(int x, int y, int far){
  if(x < 0 || x >= r || y < 0 || y >= c || a[x][y] == '#') return;
  if(far == m){
    ans++; return;
  }
  if(dp[x][y][far]) return;
  dp[x][y][far] = 1;
  if(s[far] == 'N') paths(x - 1, y, far + 1);
  else if(s[far] == 'S') paths(x + 1, y, far + 1);
  else if(s[far] == 'W') paths(x, y - 1, far + 1);
  else if(s[far] == 'E') paths(x, y + 1, far + 1);
  else for(int d = 0; d < 4; d++) paths(x + dx[d], y + dy[d], 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

/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status