# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130457 | sebinkim | Information (CEOI08_information) | C++14 | 865 ms | 9540 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;
vector <int> G[2020];
vector <int> A, B;
int P[2020], V[1010101];
bool chk1[2020], chk2[1010101];
int n, m, x;
void dfs1(int p, int r)
{
chk1[p] = 1;
if(r){
A.push_back(r);
chk2[r] = 1;
}
for(int &t: G[p]){
if(!chk1[V[t]]){
dfs1(V[t], t);
}
}
}
void dfs2(int p, int r)
{
chk1[p] = 0;
if(r){
B.push_back(r);
}
for(int &t: G[p]){
if(!chk2[t] && chk1[V[t]]){
dfs2(V[t], t);
}
}
}
int main()
{
int i, j, u;
scanf("%d%d", &n, &m);
for(i=1; i<=m; i++){
scanf("%d%d", &u, V + i);
G[u].emplace_back(i);
}
for(i=0; i<20; i++){
A.clear(); B.clear();
fill(chk1, chk1 + n + 1, 0);
fill(chk2, chk2 + m + 1, 0);
for(j=1; j<=n; j++){
random_shuffle(G[j].begin(), G[j].end());
}
dfs1(1, 0); dfs2(1, 0);
if(A.size() == n - 1 && B.size() == n - 1){
for(int &t: A){
printf("%d ", t);
}
printf("\n");
for(int &t: B){
printf("%d ", t);
}
printf("\n");
return 0;
}
}
printf("NONE\n");
return 0;
}
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... |
# | 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... |
# | 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... |
# | 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... |
# | 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... |
# | 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... |