# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
385699 | bladefan960 | Traffic (IOI10_traffic) | C++17 | 1353 ms | 152956 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 <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using std::cout;
using std::endl;
using std::vector;
vector<int> city_sub_num;
vector<int> parent;
int calc_sub_fans(int at, int prev, int P[], const vector<vector<int>>& neighbors) {
city_sub_num[at] = P[at];
parent[at] = prev;
for (int n : neighbors[at]) {
if (n != prev) {
city_sub_num[at] += calc_sub_fans(n, at, P, neighbors);
}
}
return city_sub_num[at];
}
int LocateCentre(int N, int P[], int S[], int D[]) {
city_sub_num = vector<int>(N);
parent = vector<int>(N);
vector<vector<int>> neighbors(N);
for (int i = 0; i < N - 1; i++) {
neighbors[S[i]].push_back(D[i]);
# | 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... |