제출 #283329

#제출 시각아이디문제언어결과실행 시간메모리
283329rqi철로 (IOI14_rail)C++14
30 / 100
89 ms632 KiB
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pi;

#define mp make_pair
#define f first
#define s second

const int MOD = 1000000007;
const int mx = 5005;
int pos1[mx];
int pos2[mx];

void findLocation(int N, int first, int location[], int stype[])
{
	stype[0] = 1;
	location[0] = first;
	
	pi mn = mp(MOD, -1);
	for(int i = 1; i < N; i++){
		pos1[i] = getDistance(0, i);
		mn = min(mn, mp(pos1[i], i));
	}

	stype[mn.s] = 2;
	location[mn.s] = first+mn.f;

	for(int i = 1; i < N; i++){
		if(i == mn.s) continue;
		pos2[i] = getDistance(mn.s, i);
	}

	for(int i = 1; i < N; i++){
		if(i == mn.s) continue;
		if(pos1[i] > pos2[i]){
			stype[i] = 1;
			location[i] = first-(pos1[i]-2*mn.f);
		}
		else{
			stype[i] = 2;
			location[i] = first+pos1[i];
		}
	}


	// stype[0] = 1;
	// location[0] = first;
	// for(int i = 1; i < N; i++){
	// 	stype[i] = 2;
	// 	location[i] = location[0]+getDistance(0, 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...