Submission #363524

#TimeUsernameProblemLanguageResultExecution timeMemory
363524silverfishRail (IOI14_rail)C++14
30 / 100
86 ms492 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; typedef long long ll; typedef unsigned long long ull; typedef unsigned int uint; typedef pair<int, int> pii; //mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); #define pb push_back #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define TC int __TC__; cin >> __TC__; while(__TC__--) #define ar array const int INF = 1e9 + 7; // C (down) : 1 // D (up) : 2 void findLocation(int n, int first, int loc[], int type[]){ loc[0] = first; type[0] = 1; ar<int,2> mn = {INF, -1}; for(int i = 1; i < n; ++i){ mn = min(mn, {getDistance(0, i), i}); } mn[0] += first; type[mn[1]] = 2; loc[mn[1]] = mn[0]; int first_d = mn[1]; for(int i = 1; i < n; ++i){ if(i == mn[1]) continue; int dist0 = getDistance(0, i), dist1 = getDistance(mn[1], i); if(dist0 > dist1){ type[i] = 1; loc[i] = mn[0] - dist1; }else{ type[i] = 2; loc[i] = first + dist0; } } return; }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:32:6: warning: unused variable 'first_d' [-Wunused-variable]
   32 |  int first_d = mn[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...