# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43677 | baactree | Tropical Garden (IOI11_garden) | C++14 | 305 ms | 55616 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 <bits/stdc++.h>
using namespace std;
int n, m, p;
vector<int> adj[150005];
vector<int> sadj[300005];
int v[300005], s[300005], cnt[300005];
int vn, sn;
stack<int> st;
int dfs(int now) {
int ret = v[now] = vn++;
st.push(now);
for (auto &there : sadj[now]) {
if (v[there] == -1)
ret = min(ret, dfs(there));
else if (s[there] == -1)
ret = min(ret, v[there]);
}
if (ret == v[now]) {
while (true) {
int temp = st.top();
st.pop();
s[temp] = sn;
cnt[sn]++;
if (temp == now)break;
}
sn++;
}
return ret;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |