# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134888 | onjo0127 | Telegraph (JOI16_telegraph) | C++11 | 67 ms | 15476 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;
const long long INF = 1LL * 1e18;
int N, A[100009], C[100009], D[100009], vs[100009];
bool fin[100009];
vector<vector<int> > R;
vector<int> T[100009];
long long ans;
void go(vector<int> &S, int x, int c) {
S.push_back(x);
vs[x] = c;
if(vs[A[x]]) {
if(!fin[x] && vs[A[x]] == c) {
vector<int> stk;
while(1) {
int tmp = S.back(); S.pop_back();
stk.push_back(tmp);
if(tmp == A[x]) break;
}
for(auto& it: stk) fin[it] = 1;
reverse(stk.begin(), stk.end());
R.push_back(stk);
}
}
else go(S, A[x], c);
}
void dfs(int x) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |