# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
243622 | osaaateiasavtnl | Meetings (JOI19_meetings) | C++14 | 3081 ms | 512 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 "meetings.h"
#include<bits/stdc++.h>
using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';
const int N = 2007;
int par[N];
int link[N];
void Solve(int n) {
for (int i = 1; i < n; ++i)
par[i] = -1;
queue <int> q;
q.push(0);
while (q.size()) {
int u = q.front(); q.pop();
vector <int> cur;
for (int v = 0; v < n; ++v) {
if (par[v] == -1 && link[u] == link[v]) {
vector <bool> del(cur.size());
bool ban = 0;
for (int i = 0; i < cur.size(); ++i) {
int x = Query(0, v, cur[i]);
if (x == v) {
del[i] = 1;
link[cur[i]] = v;
continue;
}
if (x == cur[i]) {
link[v] = cur[i];
ban = 1;
break;
}
}
if (!ban) {
vector <int> a = {v};
link[v] = v;
for (int i = 0; i < cur.size(); ++i) {
if (!del[i])
a.app(cur[i]);
}
cur = a;
}
}
}
for (int i = 0; i < n; ++i)
while (link[link[i]] != link[i])
link[i] = link[link[i]];
/*
cout << "link : ";
for (int i = 0; i < n; ++i)
cout << link[i] << ' ';
cout << endl;
*/
for (int v : cur) {
par[v] = u;
q.push(v);
}
}
for (int i = 1; i < n; ++i) {
int u = i;
int v = par[i];
if (v < u)
swap(u, v);
#ifdef HOME
cout << "edge " << u << ' ' << v << endl;
#endif
Bridge(u,v);
}
}
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... |