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 "meetings.h"
#include <algorithm>
#include <vector>
using namespace std;
vector<int> tr[305];
int vt[305], dg[305];
void f(int p) {
vt[p] = 1;
for(auto x:tr[p]) dg[x]--;
for(auto x:tr[p]) {
if(!dg[x] && !vt[x]) {
Bridge(min(x, p), max(x, p));
f(x);
}
}
}
void Solve(int N) {
int i, j, re;
for(i=1; i<N; i++) {
for(j=i+1; j<N; j++) {
re = Query(0, i, j);
if(re != i) tr[re].push_back(i);
if(re != j) tr[re].push_back(j);
}
}
for(i=0; i<N; i++) {
sort(tr[i].begin(), tr[i].end());
tr[i].erase(unique(tr[i].begin(), tr[i].end()), tr[i].end());
for(auto x:tr[i]) dg[x]++;
}
f(0);
}
# | 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... |