Submission #596560

#TimeUsernameProblemLanguageResultExecution timeMemory
596560EliasRail (IOI14_rail)C++17
30 / 100
72 ms468 KiB
#include <bits/stdc++.h> using namespace std; #ifndef _DEBUG #include "rail.h" #endif #ifdef _DEBUG int getDistance(int i, int j) { return j - i; } #endif int n; vector<bool> found; void findLocation(int n, int first, int location[], int stype[]) { ::n = n; location[0] = first; stype[0] = 1; int a = 0; vector<int> distA(n); vector<int> distB(n); for (int i = 0; i < n; i++) distA[i] = getDistance(a, i); distA[a] = 10000000; int b = min_element(distA.begin(), distA.end()) - distA.begin(); stype[b] = 2; location[b] = distA[b] + first; for (int i = 0; i < n; i++) distB[i] = getDistance(b, i); distB[b] = 10000000; for (int i = 0; i < n; i++) { if (i == a || i == b) continue; if (distA[i] < distB[i]) { stype[i] = 2; location[i] = location[a] + distA[i]; } else { stype[i] = 1; location[i] = location[b] - distB[i]; } } } #ifdef _DEBUG int main() { int location[10]; int stype[10]; } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...