結果

問題 No.90 品物の並び替え
ユーザー simansiman
提出日時 2015-11-05 17:11:37
言語 Ruby
(3.3.0)
結果
AC  
実行時間 3,971 ms / 5,000 ms
コード長 205 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 11,532 KB
実行使用メモリ 15,384 KB
最終ジャッジ日時 2023-10-11 14:03:17
合計ジャッジ時間 6,278 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,008 KB
testcase_01 AC 292 ms
15,192 KB
testcase_02 AC 77 ms
15,012 KB
testcase_03 AC 96 ms
15,168 KB
testcase_04 AC 115 ms
15,328 KB
testcase_05 AC 377 ms
15,384 KB
testcase_06 AC 259 ms
15,208 KB
testcase_07 AC 87 ms
15,264 KB
testcase_08 AC 81 ms
15,048 KB
testcase_09 AC 3,971 ms
15,188 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets
l=$<.map{|s|s.split.map &:to_i}.sort_by{|e|-e[2]}
m=t=0;l.map{|e|t+=e[-1]}
d=[*(0...n.to_i)]
d.permutation.each{|a|
h=a.zip(d).to_h
s=t;l.take_while{|e|x,y,v=*e;h[y]<h[x]&&s-=v;s>m};m<s&&(m=s)
}
p m
0