Submission #550700

#TimeUsernameProblemLanguageResultExecution timeMemory
550700CSQ31Rail (IOI14_rail)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int d[5001][5001]; void findLocation(int n, int f, int location[], int stype[]) { for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ d[i][j] = d[j][i] = getDistance(i,j); } } location[0] = f; stype[0] = 1; vector<int>mn(n,0); for(int i=0;i<n;i++){ int c = 1e9; for(int j=0;j<n;j++){ if(i==j)continue; if(c > d[i][j]){ c = d[i][j]; mn[i] = j; } } } int x = mn[0]; stype[x] = 2; location[x] = d[x][0]; for(int i=1;i<n;i++){ if(mn[i] == 0){ stype[i] = 2; location[i] = f + d[0][i]; } } int c = 1e9; for(int i=0;i<n;i++){ if(stype[i] == 2){ if(c > location[i]){ c = location[i]; x = i; } } } for(int i=0;i<n;i++){ if(!stype[i]){ stype[i] = 1; location[i] = c-d[i][x]; } } //for(int i=0;i<n;i++)cout<<stype[i]<<" "<<location[i]<<'\n'; }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:8:24: error: 'getDistance' was not declared in this scope
    8 |    d[i][j] = d[j][i] = getDistance(i,j);
      |                        ^~~~~~~~~~~