제출 #115397

#제출 시각아이디문제언어결과실행 시간메모리
115397faustaadpRail (IOI14_rail)C++17
8 / 100
74 ms512 KiB
#include "rail.h"
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll i,x[5050],cal;
void findLocation(int N, int first, int location[], int stype[])
{
	//if(N>100)
	//	while(1);
	location[0]=first;
	stype[0]=1;
	if(N==1)
		return ;
	ll cal=1;
	for(i=1;i<N;i++)
	{
		x[i]=getDistance(0,i);
		if(x[i]<x[cal])
			cal=i;
	//	cout<<i<<" "<<location[i]<<" "<<stype[i]<<"\n";
	}
	location[cal]=location[0]+x[cal];
	stype[cal]=2;
	//cout<<cal<<"cal\n";
	for(i=1;i<N;i++)
	{
		if(cal==i)continue;
		if(getDistance(cal,i)>x[i])
		{
			location[i]=location[0]+x[i];
			stype[i]=2;
		}
		else
		{
			location[i]=location[1]-getDistance(cal,i);
			stype[i]=1;
		}
	}
//	for(i=0;i<N;i++)
//		cout<<i<<" "<<stype[i]<<" "<<location[i]<<"\n";
}
	
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...