# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404883 | Joshc | Tropical Garden (IOI11_garden) | C++11 | 192 ms | 61980 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 "garden.h"
#include "gardenlib.h"
#include <algorithm>
#include <vector>
using namespace std;
const int INF = 2000000000;
vector<int> edges[150001], edges2[300001], num[300001], num2[300001];
int dist[300001], dist2[300001], m[300001], m2[300001], x = 0, y = 0;
void dfs(int v, int p, int cur, int dist[], int& len) {
dist[v] = cur;
for (int i : edges2[v]) {
if (i == p) continue;
if (dist[i] != INF) len = cur+1;
else dfs(i, v, cur+1, dist, len);
}
}
void count_routes(int n, int z, int p, int r[][2], int q, int g[]) {
for (int i=0; i<z; i++) {
edges[r[i][0]].push_back(r[i][1]);
edges[r[i][1]].push_back(r[i][0]);
}
for (int i=0; i<n; i++) {
edges2[edges[i][0]*2 + (i == edges[edges[i][0]][0])].push_back(i*2);
if (edges[i].size() == 1) edges2[edges[i][0]*2 + (i == edges[edges[i][0]][0])].push_back(i*2+1);
else edges2[edges[i][1]*2 + (i == edges[edges[i][1]][0])].push_back(i*2+1);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |