Submission #139027

#TimeUsernameProblemLanguageResultExecution timeMemory
139027muradeynRail (IOI14_rail)C++14
30 / 100
84 ms504 KiB
#include "rail.h"
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;

void findLocation(int N, int first, int location[], int stype[])
{
	location[0] = first;
	stype[0] = 1;
	if (N == 1)return;
	int mn = INT_MAX , in;
	for (int i = 1;i<N;i++) {
		int ret = getDistance(0 , i);
		if (ret < mn) {
			mn = ret;
			in = i;
		}
	}
	location[in] = first + mn;
	stype[in] = 2;
	for (int i = 1;i<N;i++) {
		if (i == in)continue;
		int ret = getDistance(0 , i);
		int ret2 = getDistance(i , in);
		if (ret < ret2) {
			location[i] = first + ret;
			stype[i] = 2;
		}
		else {
			location[i] = first + mn - ret2;
			stype[i] = 1;
		}
	}
}

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:21:13: warning: 'in' may be used uninitialized in this function [-Wmaybe-uninitialized]
  location[in] = first + mn;
             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...