Submission #50230

#TimeUsernameProblemLanguageResultExecution timeMemory
50230Just_Solve_The_ProblemRail (IOI14_rail)C++11
30 / 100
110 ms34556 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; int getdis(int i, int j) { if (i == j) return 0; if (dis[i][j] != 0) return dis[i][j]; dis[i][j] = dis[j][i] = getDistance(i, j); return dis[i][j]; } void findLocation(int nn, int first, int location[], int stype[]) { n = nn; mn.fr = inf; stype[0] = 0; location[0] = first; for (int i = 1; i < n; i++) { mn = min(mn, mk(getdis(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 (getdis(0, i) + mn.fr == getdis(mn.sc, i)) { stype[i] = 1; location[i] = first + dis[0][i]; } else { stype[i] = 0; location[i] = location[mn.sc] - getdis(mn.sc, i); } } for (int i = 0; i < n; i++) stype[i]++; } /* 4 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...