# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1065344 | Mr_Husanboy | Friend (IOI14_friend) | C++17 | 0 ms | 0 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 "friend.h"
#include<vector>
#include <algorithm>
#include <iostream>
using namespace std;
// Find out best sample
vector<vector<int>> g;
vector<int> vis, col, mt;
void paint(int i, int c){
col[i] = c;
for(auto u : g[i]){
if(col[u]) {assert(col[u] == -c); continue;}
paint(u, -c);
}
}
bool kuhn(int i){
if(vis[i]) return false;
vis[i] = 1;
for(auto u : g[i]){
if(mt[u] == -1 || kuhn(mt[u])){
mt[u] = i;
return true;
}
}