Submission #348635

#TimeUsernameProblemLanguageResultExecution timeMemory
348635amunduzbaevRail (IOI14_rail)C++14
8 / 100
85 ms768 KiB
#include "rail.h"
 
#ifndef EVAL
#include "grader.cpp"
#endif
 
//#include "grader.cpp"
 
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Pi acos(-1);
#define mod 1e9+7
#define inf 1e18
 
typedef long long ll;
//#define int ll
typedef long double ld;
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<ll> vll;
typedef vector<int> vii;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}
 
const int N = 2e5+5;
 
int dis[N], used[N];
 
void findLocation(int n, int cc, int location[], int stype[]){
	set<pii> ss;
	for(int i=1;i<n;i++){
		dis[i] = getDistance(0, i);
		location[i] = cc + dis[i];
		stype[i] = 2;
		ss.insert({dis[i], i});
	}
	location[0] = cc, stype[0] = 1;
	while(sz(ss)){
		auto cur = ss.begin();
		ss.erase(cur);
		if(used[(*cur).ss]) continue;
		used[(*cur).ss] = 1;
		int mn = (*cur).ss;
		for(int i=1;i<=n;i++){
			if(used[i] || i == mn) continue;
			int tt = getDistance(i, mn);
			if(tt < dis[i]){
				location[i] = cc - dis[mn] - tt;
				stype[i] = 1;
				used[i] = 1;
			}
		}
		//ss.erase(cur);
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...