이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"rail.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
const int mod = 1e9 + 7;
const int MAXN = 1e6 + 15;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
void findLocation(int n, int first, int location[], int stype[]){
vector<vector<int>> dis(n, vector<int>(n));
vector<pii> mn(n, make_pair(1e8, 1e8));
int m = 0;
for (int i = 0; i < n; i++){
for (int j = i + 1; j < n; j++){
m++;
dis[i][j] = getDistance(i, j);
dis[j][i] = dis[i][j];
}
}
assert(m == (n * (n - 1) / 2));
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
if (i == j) continue;
ckmin(mn[i], {dis[i][j], j});
}
}
for (int i = 0; i < n; i++){
stype[i] = -1;
}
location[0] = first;
stype[0] = 1;
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
if (stype[j] == -1 && stype[mn[j].S] != -1){
if (stype[mn[j].S] == 1){
stype[j] = 2;
location[j] = location[mn[j].S] + mn[j].F;
} else{
stype[j] = 1;
location[j] = location[mn[j].S] - mn[j].F;
}
}
}
}
}
# | 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... |