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 <bits/stdc++.h>
#include "rail.h"
using namespace std;
#define vt vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,x) for(int (i) = 0; (i) < (x); (i)++)
#define INF 0x3f3f3f3f
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
typedef vt<int> vi;
typedef pair<int,int> pii;
int dist[102][102];
void findLocation(int n,int first, int location[], int stype[]){
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
dist[i][j] = getDistance(i,j);
}
}
location[0] = first;
stype[0] = 1;
int c = -1;
int MinDist = INF;
for(int i =1; i < n; i++){
if(dist[0][i]<MinDist){
MinDist = dist[0][i];
c = i;
}
}
location[c] = first+dist[0][c];
stype[c] = 2;
for(int i = 1; i < n; i++){
if(i==c)continue;
if(dist[0][i]-dist[c][i]==dist[0][c]){
location[i] = location[c]-dist[c][i];
stype[i] = 1;
}else{
location[i] = first + dist[0][i];
stype[i] = 2;
}
}
}
# | 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... |