$|=<>; @k=0..99; for(0..49){ $d0=sprintf("%02d",$_*2); $d1=sprintf("%02d",$_*2+1); @kc=@k; while(1){ @q=('??')x100; $mc=$kc[@kc/2]; for(@kc){ $q[$_]=$_<$mc?$d0:$d1; } print"@q\n"; $r=(glob<>)[2]; if($r==0){ @k0=grep{$_>=$mc}@kc; @k1=grep{$_<$mc}@kc; last; } if($r==1){ @q=('??')x100; for(@kc){ $q[$_]=$d0 if$_<$mc; } print"@q\n"; $r=(glob<>)[2]; if($r==0){ @kc=grep{$_>=$mc}@kc; }else{ @kc=grep{$_<$mc}@kc; } } if($r==2){ @k0=grep{$_<$mc}@kc; @k1=grep{$_>=$mc}@kc; last; } } while(@k0>1&&@k1>1){ @q=('??')x100; $m0=$k0[@k0/2]; for(@k0){ $q[$_]=$d0 if$_<$m0; } $m1=$k1[@k1/2]; for(@k1){ $q[$_]=$d1 if$_<$m1; } print"@q\n"; $r=(glob<>)[2]; if($r==0){ @k0=grep{$_>=$m0}@k0; @k1=grep{$_>=$m1}@k1; } if($r==1){ @q=('??')x100; for(@k0){ $q[$_]=$d0 if$_<$m0; } print"@q\n"; $r=(glob<>)[2]; if($r==0){ @k0=grep{$_>=$m0}@k0; @k1=grep{$_<$m1}@k1; }else{ @k0=grep{$_<$m0}@k0; @k1=grep{$_>=$m1}@k1; } } if($r==2){ @k0=grep{$_<$m0}@k0; @k1=grep{$_<$m1}@k1; } } while(@k0>1){ @q=('??')x100; $m0=$k0[@k0/2]; for(@k0){ $q[$_]=$d0 if$_<$m0; } print"@q\n"; $r=(glob<>)[2]; if($r==0){ @k0=grep{$_>=$m0}@k0; } if($r==1){ @k0=grep{$_<$m0}@k0; } } while(@k1>1){ @q=('??')x100; $m1=$k1[@k1/2]; for(@k1){ $q[$_]=$d1 if$_<$m1; } print"@q\n"; $r=(glob<>)[2]; if($r==0){ @k1=grep{$_>=$m1}@k1; } if($r==1){ @k1=grep{$_<$m1}@k1; } } @k=grep{$_ ne$k0[0]&&$_ ne$k0[1]}@k; $a[$k0[0]]=$d0; $a[$k1[0]]=$d1; } print"@a\n";