이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rail.h"
#include<bits/stdc++.h>
using namespace std;
void findLocation(int N, int first, int location[], int stype[]){
stype[0]=1,location[0]=first;
vector<pair<int,int>> V;
vector<int>Cs,Ds,dfs(N);
for(int i=1;i<N;i++){
V.push_back({dfs[i]=getDistance(0,i),i});
}
sort(V.begin(),V.end());
for(auto[i,j]:V){
int done=0;
for(auto k:Ds){
int x=getDistance(j,k);
if(i==x+dfs[k]){
stype[j]=1;
Cs.push_back(j);
location[j]=location[k]-x;
done=1;
break;
}
}
if(done)
continue;
for(auto k:Cs){
int x=getDistance(j,k);
if(i==x+dfs[k]){
stype[j]=2;
location[j]=location[k]+x;
done=1;
break;
}
}
if(!done)
stype[j]=2,
location[j]=i+first,
Ds.push_back(j);
}
return;
}
# | 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... |