| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 821844 | farhan132 | Meetings (JOI19_meetings) | C++17 | 558 ms | 856 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;
typedef int ll;
typedef double dd;
typedef pair<ll , ll> ii;
typedef tuple < ll, ll, ll > tp;
#define ff first
#define ss second
#define pb push_back
#define in insert
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const ll N = 2005;
vector < ll > v[N];
ll col[N];
void dfs(ll s){
if(col[s]) return;
col[s] = 1;
for(auto u : v[s]) dfs(u);
}
vector < ii > e;
void solve(ll root, vector < ll > a){
if(a.size() == 0) return;
for(auto u : a){
v[u].clear();
}
v[root].clear();
shuffle(a.begin(), a.end(), rng);
vector < ll > nodes = {a[0]};
for(ll i = 1; i < a.size(); i++){
ll z = Query(root, a[0], a[i]);
if(z != a[i]) v[z].pb(a[i]);
if(z != root) nodes.pb(z);
}
sort(nodes.begin(), nodes.end());
nodes.erase(unique(nodes.begin(), nodes.end()), nodes.end());
sort(nodes.begin(), nodes.end(), [&](ll i, ll j){
return (Query(root, i, j) == i);
});
e.pb({root, nodes[0]});
for(ll i = 1; i < nodes.size(); i++){
e.pb({nodes[i - 1], nodes[i]});
}
nodes.pb(root);
for(auto u : nodes){
solve(u, v[u]);
}
return;
}
void Solve(int n) {
vector < ll > a;
for(ll i = 1; i < n; i++) a.pb(i);
solve(0, a);
for(auto [x, y] : e){
Bridge(min(x, y), max(x, y));
}
return;
}
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... | ||||
