結果

問題 No.90 品物の並び替え
ユーザー simansiman
提出日時 2015-11-05 14:13:57
言語 Ruby
(3.3.0)
結果
AC  
実行時間 4,044 ms / 5,000 ms
コード長 200 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 11,440 KB
実行使用メモリ 18,312 KB
最終ジャッジ日時 2023-10-11 13:58:26
合計ジャッジ時間 6,355 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,236 KB
testcase_01 AC 307 ms
15,520 KB
testcase_02 AC 84 ms
15,140 KB
testcase_03 AC 102 ms
15,184 KB
testcase_04 AC 114 ms
15,284 KB
testcase_05 AC 370 ms
15,736 KB
testcase_06 AC 257 ms
15,408 KB
testcase_07 AC 88 ms
15,192 KB
testcase_08 AC 82 ms
15,128 KB
testcase_09 AC 4,044 ms
18,312 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-1)]
d.permutation.map{|a|
h=a.zip(d).to_h
s=t;l.all?{|e|x,y,v=*e;h[y]<h[x]&&s-=v;s>m};m=[m,s].max
}
p m
0