# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
992227 | vjudge1 | 철로 (IOI14_rail) | C++17 | 40 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "rail.h"
#include<bits/stdc++.h>
using namespace std;
void findLocation(int N, int first, int location[], int stype[]){
stype[0]=1,location[0]=first;
vector<int> Cs,Ds;
for(int i=1;i<N;i++){
int a=getDistance(0,i),b=getDistance(i,0);
if(a==b) stype[i]=2,Ds.push_back(i);
else { stype[i]=1,Cs.push_back(i);
if(a<b) location[i]=first+a;
else location[i]=first-b;
}
}
int best=0;
for(auto i:Cs)
if(location[i]<location[best])
best=i;
for(auto i:Ds)
location[i]=location[best]+getDistance(best,i);
return;
if(N==1){
return;
}
if(N==2){
stype[1]=2,location[1]=first+getDistance(0,1);
}
if(N==3){
int a=getDistance(0,1),b=getDistance(1,0),c;
if(a==b) stype[1]=2,location[1]=first+a;
else stype[1]=2;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |