제출 #800759

#제출 시각아이디문제언어결과실행 시간메모리
800759BERNARB01철로 (IOI14_rail)C++17
0 / 100
46 ms468 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; #ifdef B01 #include "../deb.h" #else #define deb(...) #endif void findLocation(int n, int p, int location[], int stype[]) { vector<int> que(1, 0); vector<int> dist(n, -1); location[0] = p; stype[0] = 1; dist[0] = 0; for (int b = 0; b < (int) que.size(); b++) { int i = que[b]; if (stype[i] == -1) { continue; } int mn = INT_MAX; int mni = -1; for (int j = 1; j < n; j++) { if (stype[i] != -1) { continue; } int D = getDistance(i, j); if (D < mn) { mn = D; mni = j; } } if (mni == -1) { continue; } que.push_back(mni); stype[mni] = 3 - stype[i]; if (stype[mni] == 1) { location[mni] = location[i] - mn; } else { location[mni] = location[i] + mn; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...