Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
bool match(int now){ |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
bool match(int now){ | ||||||||
Line: 17 to 17 | ||||||||
// if(m[i] == -1) memset(vis, 0, sizeof(vis)), match(i); | ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
bool match(int now){ for(int i = 0; i < (int)g[now].size(); i++){ if(vis[g[now][i]] || now == a && g[now][i] == b || now == b && g[now][i] == a) continue; vis[g[now][i]] = 1; if(m[g[now][i]] == -1 || !vis[m[g[now][i]]] && match(m[g[now][i]])) { m[g[now][i]] = now; m[now] = g[now][i]; return true; } } return false; } //memset(m, -1, sizeof(m)); //for(int i = 0; i < n; i++) // if(m[i] == -1) memset(vis, 0, sizeof(vis)), match(i);
|