Submission #1063069

#TimeUsernameProblemLanguageResultExecution timeMemory
1063069uacoder123Rail (IOI14_rail)C++14
30 / 100
50 ms604 KiB
#include<rail.h> #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define F first #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i) #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i) #define all(x) (x).begin(), (x).end() #define sz(x) lli(x.size()) #define mp(i,a) make_pair(i,a) #define pb(a) push_back(a) #define bit(x,b) (x&(1LL<<b)) typedef long long int lli; typedef pair <lli,lli> ii; typedef pair <ii,lli> iii; typedef pair <ii,ii> iiii; typedef vector <lli> vi; typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; void findLocation(int n, int first, int location[], int stype[]) { int dis[n],mi=-1,in=1; location[0]=first; stype[0]=1; for(int i=1;i<n;++i) { dis[i]=getDistance(0,i); if(i==1) { mi=dis[i]; in=i; } else if(dis[i]<mi) { mi=dis[i]; in=i; } } location[in]=first+mi; stype[in]=2; for(int i=1;i<n;++i) { if(i==in) continue; int d=getDistance(in,i),d1; if(dis[in]+d==dis[i]) { d1=getDistance(i,in); if(d1==d) { location[i]=location[in]-d1; stype[i]=1; } else { location[i]=location[in]-d; stype[i]=2; } } else { d1=getDistance(i,0); if(d1==dis[i]) { location[i]=first+d1; stype[i]=2; } else { location[i]=first+dis[i]; stype[i]=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...