Submission #404883

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4048832021-05-15 08:37:15JoshcTropical Garden (IOI11_garden)C++11
100 / 100
192 ms61980 KiB
#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);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...