This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 200
#define mid (l+r)/2
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
typedef long long ll;
typedef short int si;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const ll mod=1e9+7;
const ll inf= 4e18;
const ld pai=acos(-1);
#include "rail.h"
int n,st;
vi v;
int dis[5009][5009];
int done[5009];
void findLocation(int N, int first, int location[], int stype[]){
n=N,st=first;
location[0]=st,stype[0]=1;
done[0]=1;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
dis[i][j]=dis[j][i]=getDistance(i,j);
}
}
int en=1e9,id=-1;
for(int i=1;i<n;i++){
if(dis[0][i]<en){
en=dis[0][i];
id=i;
}
}
location[id]=st+en,stype[id]=2;
done[id]=1;
v.pb(id);
for(int i=1;i<n;i++){
if(i==id)C;
if(dis[0][i] != dis[0][id]+dis[id][i] ){
v.pb(i);
done[i]=1;
location[i]=dis[0][i]+st;
stype[i]=2;
}
}
for(int i=0;i<n;i++){
if(done[i])C;
for(auto u:v){
if(dis[0][i]==dis[0][u]+dis[u][i]){
location[i]=location[u]-dis[u][i];
stype[i]=1;
}
}
}
}
# | 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... |