# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363524 | silverfish | Rail (IOI14_rail) | C++14 | 86 ms | 492 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 <bits/stdc++.h>
#include "rail.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pii;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pb push_back
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define TC int __TC__; cin >> __TC__; while(__TC__--)
#define ar array
const int INF = 1e9 + 7;
// C (down) : 1
// D (up) : 2
void findLocation(int n, int first, int loc[], int type[]){
loc[0] = first;
type[0] = 1;
ar<int,2> mn = {INF, -1};
for(int i = 1; i < n; ++i){
mn = min(mn, {getDistance(0, i), i});
}
mn[0] += first;
type[mn[1]] = 2;
loc[mn[1]] = mn[0];
int first_d = mn[1];
for(int i = 1; i < n; ++i){
if(i == mn[1]) continue;
int dist0 = getDistance(0, i), dist1 = getDistance(mn[1], i);
if(dist0 > dist1){
type[i] = 1;
loc[i] = mn[0] - dist1;
}else{
type[i] = 2;
loc[i] = first + dist0;
}
}
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... |