Submission #410004

#TimeUsernameProblemLanguageResultExecution timeMemory
410004LucaDantasRail (IOI14_rail)C++17
30 / 100
97 ms504 KiB
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;

constexpr int maxn = 5010;

bool mark[maxn];

int dp[maxn][maxn];

int dist(int a, int b) { return dp[a][b] ? dp[a][b] : dp[a][b] = getDistance(a, b); }

void findLocation(int N, int first, int location[], int stype[])
{
	int menor = 0, d = 0x3f3f3f3f;
	for(int i = 1; i < N; i++)
		if(dist(0, i) < d) menor = i, d = dist(0, i);
	location[0] = first;
	location[menor] = first + d;
	for(int i = 1; i < N; i++) {
		if(dist(0, i) == d + dist(menor, i)) location[i] = location[menor] - dist(menor, i);
		else location[i] = first + dist(0, i);
	}
	for(int i = 0; i < N; i++)
		if(location[i] <= first) stype[i] = 1;
		else stype[i] = 2;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...