Submission #719157

#TimeUsernameProblemLanguageResultExecution timeMemory
719157mseebacher철로 (IOI14_rail)C++17
30 / 100
80 ms468 KiB
#include "rail.h"
#include <bits/stdc++.h> 

using namespace std;

void findLocation(int n, int first, int location[], int stype[])
{
	stype[0] = 1;
	location[0] = first;
	
	int second = -1;
	int mn = 1e9;
	for(int i = 1;i<n;i++){
		if(getDistance(0,i) < mn){
			mn = getDistance(0,i);
			second = i;
		}
	}
	
	stype[second] = 2;
	location[second] = location[0]+mn;

	for(int i = 1;i<n;i++){
		if(i == second) continue;
		if(getDistance(0,i) < getDistance(second,i)){
			stype[i] = 2;
			location[i] = location[0] + getDistance(0,i);
		}else{
			stype[i] = 1;
			location[i] = location[second] - getDistance(second,i);
		}
	}
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...