結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,276 KB
testcase_01 AC 298 ms
15,140 KB
testcase_02 AC 80 ms
15,300 KB
testcase_03 AC 99 ms
15,168 KB
testcase_04 AC 114 ms
15,196 KB
testcase_05 AC 373 ms
15,260 KB
testcase_06 AC 258 ms
15,220 KB
testcase_07 AC 87 ms
15,456 KB
testcase_08 AC 82 ms
15,040 KB
testcase_09 AC 4,012 ms
15,392 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[2]}
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