結果

問題 No.277 根掘り葉掘り
ユーザー %20%20
提出日時 2018-07-30 06:00:41
言語 Perl
(5.38.2)
結果
AC  
実行時間 1,069 ms / 3,000 ms
コード長 299 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 94,764 KB
最終ジャッジ日時 2023-09-28 12:21:24
合計ジャッジ時間 12,410 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,636 KB
testcase_01 AC 2 ms
4,740 KB
testcase_02 AC 3 ms
4,692 KB
testcase_03 AC 3 ms
4,632 KB
testcase_04 AC 3 ms
4,800 KB
testcase_05 AC 3 ms
4,848 KB
testcase_06 AC 4 ms
4,724 KB
testcase_07 AC 3 ms
4,648 KB
testcase_08 AC 3 ms
4,852 KB
testcase_09 AC 862 ms
94,248 KB
testcase_10 AC 840 ms
93,504 KB
testcase_11 AC 972 ms
94,560 KB
testcase_12 AC 947 ms
94,764 KB
testcase_13 AC 1,069 ms
94,436 KB
testcase_14 AC 947 ms
94,288 KB
testcase_15 AC 931 ms
94,416 KB
testcase_16 AC 930 ms
94,280 KB
testcase_17 AC 915 ms
94,076 KB
testcase_18 AC 919 ms
94,220 KB
testcase_19 AC 900 ms
94,152 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$N=<>;
/ /,++$_[$`],++$_[$'],push@{$`},$'+!push@{$'+0},$`for<>;
@q=grep!($L[$_]=$_[$_]-1&&$N),1..$N;
push@q,grep{$L[$_]-=$-=$L[$_]-$L[$q]-1;$-}@$q while$q=shift@q;
@R=(0,0,($N)x($N-1));@q=1;
push@q,grep{$R[$_]-=$-=$R[$_]-$R[$q]-1;$-}@$q while$q=shift@q;
print$L[$_]<$R[$_]?$L[$_]:$R[$_],$/for 1..$N
0