Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int MSIZE = 500 * 500;
- const int delta = 500;
- vector<int> g[MSIZE];
- bool used[MSIZE];
- int mt[MSIZE];
- int inc(int v) {
- if (used[v]) return false;
- used[v] = true;
- for (int nxt : g[v]) {
- if (mt[nxt] == -1) {
- mt[nxt] = v;
- return true;
- }
- }
- for (int nxt : g[v]) {
- if (inc(mt[nxt])) {
- mt[nxt] = v;
- return true;
- }
- }
- return false;
- }
- void GetMT(pair<int,vector<int> > * kek) {
- memset(used, 0, sizeof used);
- fill(mt, mt + MSIZE, -1);
- int ans = 0;
- for (int i = 0; i < MSIZE; i++) {
- if (inc(i)) {
- memset(used, 0, sizeof used);
- ans++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement