結果

問題 No.165 四角で囲え!
ユーザー tailstails
提出日時 2015-03-13 00:17:33
言語 Perl
(5.38.2)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 623 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 5,332 KB
実行使用メモリ 32,284 KB
最終ジャッジ日時 2023-09-11 08:08:55
合計ジャッジ時間 13,000 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

($n,$b)=<>=~/\d+/g;

for(<>){
    ($x[$i],$y[$i],$p[$i])=/\d+/g;
    ++$i;
}

%h=();
for$i(0..$n-1){
    $h{$x[$i]}=1;
}
@xs=sort{$a-$b}keys%h;

%h=();
for$i(0..$n-1){
    $h{$y[$i]}=1;
}
@ys=sort{$a-$b}keys%h;

for$y(@ys){
    for$x(@xs){
	for$i(0..$n-1){
	    if($x<=$x[$i]&&$y<=$y[$i]){
		$v{$x,$y}++;
		$w{$x,$y}+=$p[$i];
	    }
	}
    }
}

for$y0(@ys){
    for$y1(@ys){
	for$x0(@xs){
	    for$x1(@xs){
		if($w{$x0,$y0}-$w{$x0,$y1}-$w{$x1,$y0}+$w{$x1,$y1}<=$b){
		    if($r<$v{$x0,$y0}-$v{$x0,$y1}-$v{$x1,$y0}+$v{$x1,$y1}){
			$r=$v{$x0,$y0}-$v{$x0,$y1}-$v{$x1,$y0}+$v{$x1,$y1};
		    }
		}
	    }
	}
    }
}

print$r;
0