Submission #405250

#TimeUsernameProblemLanguageResultExecution timeMemory
405250blueRail (IOI14_rail)C++17
30 / 100
101 ms984 KiB
#include "rail.h" #include <iostream> #include <vector> #include <algorithm> 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'; } } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...