This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//GRT_2018
#include <bits/stdc++.h>
#include "fun.h"
#define PB push_back
#define ST first
#define ND second
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
//int hoursRequired(int x, int y) {
//cout << x << " " << y << endl;
//int w;
//cin >> w;
//return w;
//}
set<int>aval;
int furthest(int x) {
int w = x, d = 0;
for(int y : aval) {
if(y == x) continue;
int p = hoursRequired(x, y);
if(p > d) d = p, w = y;
}
return w;
}
vi createFunTour(int n, int q) {
for(int i = 0; i < n; ++i) aval.insert(i);
int x = furthest(0);
vi ans(n);
for(int i = 0; i < n; ++i) {
ans[i] = x;
aval.erase(x);
x = furthest(x);
}
return ans;
}
//int main() {
//ios_base::sync_with_stdio(0);
//cin.tie(0);
//auto v = createFunTour(7, 1);
//for(int x : v) cout << x << " ";
//}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |