# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
962111 | IUA_Hasin | Rail (IOI14_rail) | C++17 | 50 ms | 648 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>
#define endl "\n"
#define yeap cout<<"YES"<<endl
#define nope cout<<"NO"<<endl
#define ll long long
using namespace std;
const ll M = 5001;
ll vis[M];
void findLocation(int N, int first, int location[], int stype[])
{
location[0] = first;
stype[0] = 1;
vector<pair<ll, ll>> v;
for(int i=1; i<N; i++){
ll a = getDistance(0, i);
v.push_back({a, i});
}
ll mn = v[0].first;
ll mnind = v[0].second;
for(int i=0; i<v.size(); i++){
ll a = v[i].first;
ll b = v[i].second;
// cout << a << " " << b << endl;
if(a<mn){
mn = a;
mnind = b;
}
}
// cout<<endl;
// cout << mn << " " << mnind << endl;
// cout<<endl;
location[mnind] = first+mn;
stype[mnind] = 2;
for(int i=1; i<N; i++){
if(i!=mnind){
ll a = getDistance(0, i);
ll b = getDistance(mnind, i);
// cout << a << " " << b << endl;
if((mn+b)==a){
stype[i] = 1;
location[i] = location[mnind]-b;
}
}
}
// cout<<endl;
// for(int i=0; i<N; i++){
// cout << stype[i] << " " << location[i] << endl;
// }
}
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... |