Submission #50227

#TimeUsernameProblemLanguageResultExecution timeMemory
50227Just_Solve_The_ProblemRail (IOI14_rail)C++11
30 / 100
556 ms98660 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; #define pb push_back #define eb emplace_back #define ll long long #define pii pair < int, int > #define fr first #define sc second #define mk make_pair #define sz(s) (int)s.size() #define all(s) s.begin(), s.end() #define Ok puts("ok"); #define whatis(x) cerr << #x << " = " << x << endl; #define pause system("pause"); #define random (rand() ^ (rand() << 15)) const int N = (int)5e3 + 7; const int inf = (int)1e9 + 7; int n; int dis[N][N]; pii mn; void findLocation(int nn, int first, int location[], int stype[]) { n = nn; mn.fr = inf; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { dis[i][j] = getDistance(i, j); } } stype[0] = 0; location[0] = first; for (int i = 1; i < n; i++) { mn = min(mn, mk(dis[0][i], i)); } stype[mn.sc] = 1; location[mn.sc] = mn.fr + first; for (int i = 1; i < n; i++) { if (i == mn.sc) continue; if (dis[0][i] + mn.fr == dis[mn.sc][i]) { stype[i] = 1; location[i] = first + dis[0][i]; } else { stype[i] = 0; location[i] = location[mn.sc] - dis[mn.sc][i]; } } for (int i = 0; i < n; i++) stype[i]++; } /* 2 4 1 3 2 5 1 2 1 1 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...