# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
697166 | sharaelong | Fun Tour (APIO20_fun) | C++17 | 121 ms | 16580 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 "fun.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
vector<int> createFunTour(int n, int q) {
if (n == 2) return vector<int>{0,1};
vector<int> origin_sz(n, 0);
for (int i=1; i<n; ++i) origin_sz[i] = attractionsBehind(0, i);
int min_val = n;
int cent = 0;
for (int i=1; i<n; ++i) {
if (origin_sz[i] > n/2 && min_val > origin_sz[i]) {
min_val = origin_sz[i];
cent = i;
}
}
// cout << cent << endl;
vector<int> dist(n, 0);
vector<int> subtree_root;
for (int i=0; i<n; ++i) {
dist[i] = hoursRequired(cent, i);
if (dist[i] == 1) subtree_root.push_back(i);
// cout << dist[i] << ' ';
}
// cout << endl;
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |