Field testing: Kattis sensor */
| 1 | /* Field testing: Kattis sensor */ |
| 2 | void test() { |
| 3 | rep(ite,0,10000) { |
| 4 | int n = rng() % 400 + 1, |
| 5 | m = rng() % 400 + 1; |
| 6 | int k = rng() % n + 1; |
| 7 | vii es; |
| 8 | rep(i,0,n) { |
| 9 | rep(j,0,m) { |
| 10 | if (rng() % k == 0) { |
| 11 | es.push_back(ii(i,j)); |
| 12 | } |
| 13 | } |
| 14 | } |
| 15 | bipartite_graph g(n,m); |
| 16 | iter(it,es) { |
| 17 | g.add_edge(it->first, it->second); |
| 18 | } |
| 19 | int sz = g.maximum_matching(); |
| 20 | vector<int> res = mvc_bipartite(g); |
| 21 | set<int> cover; |
| 22 | iter(it,res) cover.insert(*it); |
| 23 | assert(size(res) == sz); |
| 24 | int LEFT = 0, |
| 25 | RIGHT = n; |
| 26 | rep(i,0,size(es)) { |
| 27 | int a = LEFT + es[i].first, |
| 28 | b = RIGHT + es[i].second; |
| 29 | assert(cover.find(a) != cover.end() || |
| 30 | cover.find(b) != cover.end()); |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | // vim: cc=60 ts=2 sts=2 sw=2: |
nothing calls this directly
no test coverage detected