Submission #551557

#TimeUsernameProblemLanguageResultExecution timeMemory
551557AJ00Rail (IOI14_rail)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <rail.h> using namespace std; void findLocation(int N, int first, int[] location, int[] stype){ int n = N; location[0] = first; stype[0] = 1; if (n == 1){ return; } for (int i = 0; i < n; i++){ stype[i] = -1; for (int j = i+1; j < n; j++){ dist[i][j] = getDistance(i,j); dist[j][i] = dist[i][j]; } } stype[0] = 1; for (int i = 0; i < n; i++){ for (int j = i+1; j < n; j++){ if (dist[0][i] == dist[0][j]+dist[i][j]){ location[j] = dist[0][j]+location[0]; location[i] = location[j]-dist[i][j]; stype[j] = 2; stype[i] = 1; } else if (dist[0][j] == dist[0][i]+dist[i][j]){ location[i] = dist[0][i]+location[0]; location[j] = location[i]-dist[i][j]; stype[i] = 2; stype[j] = 1; } } } for (int i = 0; i < n; i++){ if (stype[i] == -1){ location[i] = dist[0][i]+location[0]; stype[i] = 2; } } return; }

Compilation message (stderr)

rail.cpp:5:43: error: expected ',' or '...' before 'location'
    5 | void findLocation(int N, int first, int[] location, int[] stype){
      |                                           ^~~~~~~~
rail.cpp: In function 'void findLocation(int, int, int*)':
rail.cpp:7:5: error: 'location' was not declared in this scope; did you mean 'localtime'?
    7 |     location[0] = first;
      |     ^~~~~~~~
      |     localtime
rail.cpp:8:5: error: 'stype' was not declared in this scope; did you mean 'wctype'?
    8 |     stype[0] = 1;
      |     ^~~~~
      |     wctype
rail.cpp:15:13: error: 'dist' was not declared in this scope
   15 |             dist[i][j] = getDistance(i,j);
      |             ^~~~
rail.cpp:22:17: error: 'dist' was not declared in this scope
   22 |             if (dist[0][i] == dist[0][j]+dist[i][j]){
      |                 ^~~~
rail.cpp:38:27: error: 'dist' was not declared in this scope
   38 |             location[i] = dist[0][i]+location[0];
      |                           ^~~~