Submission #1230814

#TimeUsernameProblemLanguageResultExecution timeMemory
1230814kl0989eRail (IOI14_rail)C++20
30 / 100
32 ms584 KiB
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pi pair<int, int>
#define pl pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()

void findLocation(int n, int f, int loc[], int tpe[]) {
	loc[0]=f;
	tpe[0]=1;
	vi dst(n,0);
	int mn=1;
	for (int i=1; i<n; i++) {
		dst[i]=getDistance(0,i);
		if (dst[i]<dst[mn]) {
			mn=i;
		}
	}
	loc[mn]=f+dst[mn];
	tpe[mn]=2;
	for (int i=1; i<n; i++) {
		if (i==mn) {
			continue;
		}
		if (getDistance(mn,i)<dst[i]) {
			loc[i]=f+2*dst[mn]-dst[i];
			tpe[i]=1;
		}
		else {
			loc[i]=f+dst[i];
			tpe[i]=2;
		}
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...