Submission #48304

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
483042018-05-11 15:12:16cheater2kRail (IOI14_rail)C++17
100 / 100
212 ms98884 KiB
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
const int inf = 1e9;
int dis[maxn][maxn];
void findLocation(int n, int first, int location[], int stype[]) {
auto set_type = [&](int id, int pos, int type) {
//cerr << "set " << id << ' ' << pos << ' ' << type << endl;
assert(pos >= 0 && pos <= 1000000);
location[id] = pos;
stype[id] = type;
};
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
dis[i][j] = (i == j) ? 0 : -1;
}
}
int d, mn = inf;
set_type(0, first, 1);
for (int i = 1; i < n; ++i) {
dis[0][i] = getDistance(0, i);
if (dis[0][i] < mn) {
mn = dis[0][i], d = i; // d is of type D, which is nearest to station 0
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

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