Submission #705288

#TimeUsernameProblemLanguageResultExecution timeMemory
705288Hacv16Rail (IOI14_rail)C++17
0 / 100
69 ms520 KiB
#include <bits/stdc++.h>
#include "rail.h"

const int MAX = 2e6 + 15;
const int INF = 0x3f3f3f3f;

int dist[MAX][2];

void findLocation(int n, int first, int location[], int stype[]){
	int mn = INF, mnId = 0;

	for(int i = 1; i < n; i++){
		int curDist = getDistance(0, i);
		dist[i][0] = curDist;

		if(dist[i][0] < mn)
			mn = dist[i][0], mnId = i;
	}

	for(int i = 1; i < n; i++){
		int curDist = getDistance(mnId, i);	
		dist[i][1] = curDist;
	}

	location[mnId] = first + dist[mnId][0];
	stype[mnId] = 2;

	for(int i = 1; i < n; i++){
		if(i == mnId) continue;

		bool dir = false; 
		if (dist[i][1] < dist[i][0]) dir = false;
		
		if(!dir) stype[i] = 1;
		else stype[i] = 2;

		if(dir) location[i] = first + dist[i][0];
		else location[i] = location[mnId] - dist[i][1];
 	}
}	
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...