# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103374 | wxh010910 | Tropical Garden (IOI11_garden) | C++17 | 3 ms | 504 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 "garden.h"
#include "gardenlib.h"
using namespace std;
void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) {
vector<int> deg(N);
vector<int> most(N, -1);
for (int i = 0; i < M; ++i) {
for (int j = 0; j < 2; ++j) {
++deg[R[i][j]];
if (most[R[i][j]] == -1) {
most[R[i][j]] = i;
}
}
}
vector<int> to(N * 2, -1);
for (int i = 0; i < M; ++i) {
for (int j = 0; j < 2; ++j) {
if (to[R[i][j]] == -1) {
to[R[i][j]] = R[i][!j] + N * (most[R[i][!j]] == i && deg[R[i][!j]] > 1);
} else if (to[R[i][j] + N] == -1) {
to[R[i][j] + N] = R[i][!j] + N * (most[R[i][!j]] == i && deg[R[i][!j]] > 1);
}
}
}
vector<vector<int>> adj(N * 2);
for (int i = 0; i < N; ++i) {
adj[to[i]].push_back(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... |