<Verbatim> 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); </Verbatim> * Set ALLOWTOPICCHANGE = MatthewChan, YuryKholondyrev, SapphireJay
This topic: Main
>
ProgrammingContest
>
Code_BPTShort
Topic revision: r3 - 2005-11-18 - MatthewChan
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback