Submission #385439

#TimeUsernameProblemLanguageResultExecution timeMemory
385439KeshiRail (IOI14_rail)C++17
0 / 100
83 ms620 KiB
//In the name of God
#include <bits/stdc++.h>
#include "rail.h"
using namespace std;

typedef int ll;
typedef pair<ll, ll> pll;

const ll maxn = 2e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e9;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()

ll dis[maxn];

void findLocation(int n, int first, int location[], int stype[]){
	dis[0] = inf;
	ll x = 0;
	for(ll i = 1; i < n; i++){
		dis[i] = getDistance(0, i);
		if(dis[i] < dis[x]) x = i;
	}
	stype[0] = 1;
	for(ll i = 1; i < n; i++){
		if(x == i || dis[i] < getDistance(x, i)){
			location[i] = dis[i];
			stype[i] = 2;
		}
		else{
			location[i] = dis[x] * 2 - dis[i];
			stype[i] = 1;
		}
	}
	ll mn = inf;
	for(ll i = 0; i < n; i++){
		mn = min(mn, location[i]);
	}
	for(ll i = 0; i < n; i++){
		location[i] -= mn - 1;
	}
	return;
}

/*int main(){
    fast_io;



    return 0;
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...