# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
304965 | galca | Stations (IOI20_stations) | C++14 | 1253 ms | 1056 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 "stations.h"
#include <vector>
using namespace std;
int label_nodes(vector<vector<int>>& nodes, vector<int>& labels, bool isMin, int id, int me, int father) {
if ((father != -1) && (nodes[me].size() == 1)) {
// a leaf
labels[me] = id;
return id+1;
}
if (isMin) {
labels[me] = id;
int next_id = id + 1;
for (int i = 0; i < nodes[me].size(); i++) {
if (nodes[me][i] != father) {
next_id = label_nodes(nodes, labels, !isMin, next_id, nodes[me][i], me);
}
}
return next_id;
}
else {
int next_id = id;
for (int i = 0; i < nodes[me].size(); i++) {
if (nodes[me][i] != father) {
next_id = label_nodes(nodes, labels, !isMin, next_id, nodes[me][i], me);
}
}
labels[me] = next_id;
return next_id + 1;
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... |