# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
639671 | Hacv16 | Tropical Garden (IOI11_garden) | C++17 | 0 ms | 0 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>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MAX = 2e6 + 15;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
#define pb push_back
#define sz(x) (int) x.size()
#define fr first
#define sc second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << ": " << "[ " << x << " ]\n"
int dist[MAX][2], cyc[2];
bool seen[MAX][2];
vector<int> adj[MAX], rev[MAX];
void dfs(int u, int end, int d, int aux){
seen[u][aux] = true;
dist[u][aux] = d;
for(auto v : adj[u]){
if(v == end){
cyc[aux] = dist[u][aux] + 1;
break;