The K Large as the first K Small Variety wa ...
The K Big is the first ? K + 1 Small, so you can have a happy two-point answer
The two-point answer finds the coordinates of the position of the number that are smaller than the current answer, and determines if it is possible to select one that satisfies the same column in the same row ? K + 1 Number, and then you can happily run Hungary, for a coordinate x , Y ) If you meet a[x][y]≤ The current answer, the first x Line to section y Column and then run Hungary to determine whether the maximum match is greater than ? K + 1
Hungary really runs fast, and then it snaps into Rank1 Qaq
#include <algorithm>#include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <vector>#include <cmath>#include <queue>#include <set>#include <map>#define LL Long Long#define N 1000001using namespace STD;intSC () {intI=0, f=1;CharC=getchar (); while(c>' 9 '|| c<' 0 '){if(c=='-') f=-1; C=getchar ();} while(c>=' 0 '&&c<=' 9 ') i=i*Ten+c-' 0 ', C=getchar ();returnI*f;}inta[255][255];intHead[n],nxt[n],lst[n],tim[n],from[n];intN,m,tot,mx,ti,k;voidInsertintXintY) {Lst[++tot]=y;nxt[tot]=head[x];head[x]=tot;}BOOLHungary (intx) { for(intI=head[x];i;i=nxt[i])if(Tim[lst[i]]!=ti) {Tim[lst[i]]=ti;if(!from[lst[i]]| | Hungary (From[lst[i])) {from[lst[i]]=x;return 1; } }return 0;}BOOLJudintx) {intans=0; tot=0; for(intI=1; i<=n;i++) head[i]=0; for(intI=1; i<=m;i++) from[i]=0; for(intI=1; i<=n;i++) for(intj=1; j<=m;j++)if(a[i][j]<=x) Insert (I,J); for(intI=1; i<=n;i++) ti++,ans+=hungary (i);returnAns>=k;}intMain () {N=SC (); M=sc (), K=SC (); k=n-k+1; for(intI=1; i<=n;i++) for(intj=1; j<=m;j++) Mx=max (MX,A[I][J]=SC ());intL=1, R=MX; while(L!=R) {intMid=l+r>>1;if(Jud (mid)) R=mid;ElseL=mid+1; }cout<<l;return 0;}
4443: [Scoi2015] little bald Play Matrix | Two-point ANSWER | Hungary