# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
432093 | REALITYNB | Rail (IOI14_rail) | C++17 | 86 ms | 504 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 <bits/stdc++.h>
#include "rail.h"
using namespace std;
void findLocation(int n ,int first , int* loc , int* stype){
loc[0]=first ;
stype[0]=1;
if(n==1) return ;
vector<int> a(n) ;
for(int i=0;i<n;i++) a[i]=getDistance(i,0) ;
int mn = 1e9;
for(int i=1;i<n;i++) mn=min(mn,a[i]) ;
int second ;
for(int i=1;i<n;i++) if(mn==a[i]) second=i;
vector<int> b(n) ;
stype[second]=2,loc[second]=first+mn;
for(int i=0;i<n;i++) b[i]=getDistance(i,second);
for(int i=0;i<n;i++){
if(i==second||i==0) continue ;
if(a[i]>b[i]){
stype[i]=1;
loc[i]=loc[second]-b[i] ;
}
else{
stype[i]=2;
loc[i]=loc[0]+a[i];
}
}
return ;
}
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... |