题解

34 条题解

  • 0
    @ 2009-11-13 17:00:37

    ..悲剧。。

    m,n全部打成n导致第一个通过被tangqihy抢走。。

    我是谁?见沙发I.I

  • 0
    @ 2009-11-13 17:00:33

    楼下的好可爱~~~

    杯具了~

  • 0
    @ 2009-11-13 16:58:29

    ...!!!! 通过率怎高吧!!!!

  • 0
    @ 2009-11-13 16:57:45

    type ave=array[0..50]of longint;

    var g,a,b:array[0..302]of longint;

    used:array[0..203]of boolean;

    c,d:ave;

    m,leng1,leng2,n,i,j,bb,k,ans:longint;

    v:array[0..203,0..203]of boolean;

    function max(x,y:longint):longint;

    begin

    if x>y then max:=x else max:=y;

    end;

    procedure zhuanhuan(v:longint; var leng:longint; var r:ave);

    begin

    leng:=0;

    fillchar(r,sizeof(r),0);

    if v=0 then

    begin

    leng:=1;

    exit;

    end;

    while v0 do

    begin

    inc(leng);

    r[leng]:=v mod 2;

    v:=v div 2;

    end;

    end;

    function pipei(h:longint):boolean;

    var i:longint;

    begin

    for i:=1 to m do

    begin

    if (v[h,i])and(g[i]=0) then

    begin

    g[i]:=h;

    pipei:=true;

    exit;

    end;

    if (v[h,i])and(g[i]0)and(not(used[g[i]])) then

    begin

    used[g[i]]:=true;

    if pipei(g[i]) then

    begin

    g[i]:=h;

    pipei:=true;

    exit;

    end;

    end;

    end;

    pipei:=false;

    end;

    begin

    readln(n,m);

    for i:=1 to n do read(a[i]);

    for i:=1 to m do read(b[i]);

    fillchar(v,sizeof(v),false);

    for i:=1 to n do

    for j:=1 to m do

    begin

    leng1:=0;

    zhuanhuan(a[i],leng1,c);

    leng2:=0;

    zhuanhuan(b[j],leng2,d);

    bb:=1;

    for k:=1 to max(leng1,leng2) do if c[k]=d[k] then bb:=0;

    if bb=1 then v:=true else v:=false;

    end;

    ans:=0;

    for i:=1 to n do

    begin

    fillchar(used,sizeof(used),0);

    if pipei(i) then inc(ans);

    end;

    if ans0 then writeln(ans)

    else writeln('I want nobody nobody but you');

    end.

    两星半纪念!

  • 0
    @ 2009-11-13 16:55:24

    var

    a,b:array[1..200] of longint;

    map:array[1..400,1..400] of boolean;

    match:array[1..400] of longint;

    use:array[1..400] of boolean;

    i,j,n,m,ans:longint;

    function find(x:longint):boolean;

    var

    p:longint;

    begin

    for p:=1 to n+m do

    if (map[x,p])and(not use[p]) then

    begin

    use[p]:=true;

    if (match[p]=0)or(find(match[p])) then

    begin

    match[x]:=p;

    exit(true);

    end;

    end;

    exit(false);

    end;

    begin

    readln(n,m);

    for i:=1 to n do

    read(a[i]);

    for j:=1 to m do

    read(b[j]);

    fillchar(map,sizeof(map),false);

    for i:=1 to n do

    for j:=1 to m do

    if (a[i] xor b[j]+1)and(-(a[i] xor b[j]+1))=a[i] xor b[j]+1 then

    begin

    map:=true;

    map[j+n,i]:=true;

    end;

    for i:=1 to n do

    begin

    fillchar(use,sizeof(use),false);

    if find(i) then ans:=ans+1;

    end;

    writeln(ans);

    end.

  • 0
    @ 2009-11-13 16:55:08

    难得的进前十啊...

  • 0
    @ 2009-11-13 16:55:06

    其实……

    8遍贪心=秒杀

    不太好意思了……

  • 0
    @ 2009-11-13 16:54:15

    位运算+二分图 0ms!!!

  • 0
    @ 2009-11-13 16:47:57

    .裸的最大流

  • 0
    @ 2009-11-13 16:21:25

    ......

  • 0
    @ 2009-11-11 23:01:43

    .....都好快...二分匹配..

  • 0
    @ 2009-11-11 22:25:25

    ms网络流的最大流……

  • 0
    @ 2009-11-07 01:52:46

    板凳……

    初音比赛第二题……

    听说题目背景很雷人……

  • 0
    @ 2009-11-07 01:16:55

    沙发。哈哈。

信息

ID
1693
难度
7
分类
图结构 | 二分图匹配 点击显示
标签
递交数
2047
已通过
352
通过率
17%
被复制
3
上传者