Title: Find a solution to the unique matrix correspondence point.
Method: 1, want to make a maximum match, and then each time delete a matching edge in a maximum match, to see whether the edge must.
Spit Groove: Completely did not think can be so violent, and the topic from ' A ' began marking, indicating that the topic data range is [1,26].
/************************************************author:D arktongcreated time:2016/8/1 8:33:20File Name:P o j_1486.cpp*************************************************///#include <bits/stdc++.h>#include <cstring>#include<cstdio>#include<cmath>using namespacestd;Const intMAXN = -+Ten;intW[MAXN][MAXN], N, m;intLEFT[MAXN];BOOLUSED[MAXN];BOOLMatchinti) { for(intj=1; j<=m;++j)if(w[i][j]&&!Used[j]) {Used[j]=true; if(! left[j]| |match (Left[j])) {Left[j]=i; return true; } } return false;}//returns the maximum number of matchesintHungary () {intres=0; Memset (left,0,sizeof(left)); for(intI=1; i<=n;++i) {memset (used,0,sizeof(used)); if(Match (i)) res++; } returnRes;}intrec[maxn][4], poi[maxn][2], edge[maxn][2], VIS[MAXN];intMain () {intT, cas=1; while(SCANF ("%d", &n) = =1&&N) {memset (W,0,sizeof(w)); memset (Vis,0,sizeof(VIS)); M=N; for(intI=1; i<=n;++i) scanf ("%d%d%d%d", &rec[i][0], &rec[i][1], &rec[i][2], &rec[i][3]); for(intI=1; i<=n;++i) scanf ("%d%d", &poi[i][0], &poi[i][1]); for(intI=1; i<=n;++i) for(intj=1; j<=n;++j) {if(poi[j][0]>=rec[i][0]&&poi[j][0]<=rec[i][1]&&rec[i][2]<=poi[j][1]&&poi[j][1]<=rec[i][3]) W[j][i]=1;//, printf ("--%d%d\n", j,i); } intE, ans=0; if(Hungary () = =N) {ans=N; for(intI=1; i<=n;++i) edge[i][0]=left[i], edge[i][1]=i; for(intI=1; i<=n;++i) {w[edge[i][0]][edge[i][1]]=0; if(Hungary () = =N) {//printf ("%d%d\n", edge[i][0], edge[i][1]);vis[i]=1; Ans--; } w[edge[i][0]][edge[i][1]]=1; }} printf ("Heap%d\n", cas++); if(ans==0) puts ("none\n"); Else { for(intI=1; i<=n;++i)if(!Vis[i]) {printf ("(%c,%d)",'A'+edge[i][1]-1, edge[i][0]); } puts ("\ n"); } } return 0;}
poj_1486 sorting Slides-Must side