Submission #405249

#TimeUsernameProblemLanguageResultExecution timeMemory
405249blue철로 (IOI14_rail)C++17
Compilation error
0 ms0 KiB
#include "rail.h" #include <iostream> #include <vector> using namespace std; /* Subtask 2 */ int dist[100][100]; void findLocation(int n, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; if(n == 1) return; for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) dist[i][j] = getDistance(i, j); int sort0[n]; for(int i = 0; i < n; i++) sort0[i] = i; sort(sort0, sort0+n, [] (int x, int y) { return dist[0][x] < dist[0][y]; }); int firstRight = sort0[1]; location[firstRight] = first + dist[0][firstRight]; stype[firstRight] = 2; for(int i = 1; i < n; i++) { if(i == firstRight) continue; if(dist[0][i] == dist[0][firstRight] + dist[firstRight][i]) { stype[i] = 1; location[i] = first + dist[0][firstRight] - dist[firstRight][i]; } else { stype[i] = 2; location[i] = first + dist[0][i]; } } cerr << "\n"; for(int i = 0; i < n; i++) cerr << stype[i] << ' ' << location[i] << '\n'; } /* Subtask 1 void findLocation(int n, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; for(int i = 1; i < n; i++) { location[i] = first + getDistance(0, i); stype[i] = 2; } cerr << '\n'; for(int i = 0; i < n; i++) { cerr << location[i] << ' ' << stype[i] << '\n'; } } */

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:27:5: error: 'sort' was not declared in this scope; did you mean 'sort0'?
   27 |     sort(sort0, sort0+n, [] (int x, int y)
      |     ^~~~
      |     sort0