# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
348471 | tengiz05 | 철로 (IOI14_rail) | C++17 | 3085 ms | 49388 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "rail.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
int dist[MAXN][MAXN], n;
void findLocation(int N, int first, int location[], int stype[]){
n = N;
int cnt = 0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
dist[i][j] = getDistance(i,j);
cnt++;
if(cnt >= (4999*(4999-1))/2){i=0;break;}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
assert(dist[i][j] == dist[j][i]);
}
}
stype[0]=1;
location[0]=first;
if(n == 1)return;
int cherez, mn = 1e9;
for(int i=1;i<n;i++){
if(mn > dist[0][i]){
mn = dist[0][i];
cherez = i;
}
}
//~ for(int i=0;i<n;i++){
//~ for(int j=0;j<n;j++){
//~ cout << dist[i][j] << ' ';
//~ }cout << '\n';
//~ }
for(int i=1;i<n;i++)stype[i]=2,location[i]=dist[0][i]+first;
for(int i=1;i<n;i++)
if(dist[0][i] == dist[0][cherez] + dist[cherez][i] && i!=cherez)
stype[i]=1,location[i]=location[cherez]-dist[cherez][i];
//~ for(int i=0;i<n;i++){
//~ cout << stype[i] << ' ' << location[i] << '\n';
//~ }
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |