| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1344085 | mxhrvs | Social Engineering (EGOI22_socialengineering) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
#include "social.h"
using namespace std;
const int MAXN = 200005;
vector<int> adj[MAXN];
int match[MAXN], p[MAXN], base[MAXN], q[MAXN];
bool used[MAXN], blossom[MAXN];
int lca(int a, int b, int n) {
vector<bool> used_lca(n + 1, false);
while (true) {
a = base[a];
used_lca[a] = true;
if (match[a] == 0) break;
a = p[match[a]];
}
while (true) {
b = base[b];
if (used_lca[b]) return b;
b = p[match[b]];
}
}
void SocialEngineering(int n, int m, vector<pair<int, int>> edges) {
for (auto e : edges) {
adj[e.first].push_back(e.second);
adj[e.second].push_back(e.first);
}
while (true) {
int v = GetMove();
if (v == 0) break;
int partner = match[v];
MakeMove(partner);
}
}