#include <bits/stdc++.h>
#define rep(a,b,c) for(auto a = (b); a != (c); a++)
#define repD(a,b,c) for(auto a = (b); a != (c); a--)
#define repIn(a, b) for(auto& a : (b))
#define repIn2(a, b, c) for(auto& [a, b] : (c))
constexpr bool dbg = 0;
#define DEBUG if constexpr(dbg)
#define DC DEBUG std::cerr
#define eol std::endl
#define ll long long
#define pb push_back
using namespace std;
#include "meetings.h"
void Solve(int N) {
vector<vector<bool>> isOnPath(N, vector<bool>(N, 0));
vector<int> depth(N, 1);
depth[0] = 0;
rep(dest, 1, N) rep(mid, 1, N) if(mid != dest) isOnPath[dest][mid] = Query(0, dest, mid) == mid, depth[dest] += isOnPath[dest][mid];
rep(dest, 1, N) {
DC << "Path 0 -> " << dest << " contains: ";
rep(mid, 1, N) if(isOnPath[dest][mid]) DC << mid << ' ';
DC << eol;
}
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> Q;
rep(i, 1, N) Q.push({depth[i], i});
while(!Q.empty()) {
auto [md, v] = Q.top(); Q.pop();
auto p = 0;
rep(i, 1, N) if(isOnPath[v][i] && depth[i] + 1 == md) p = i;
Bridge(p, v);
}
}
# | 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... |