結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,084 KB
testcase_01 AC 302 ms
15,584 KB
testcase_02 AC 78 ms
15,208 KB
testcase_03 AC 97 ms
15,368 KB
testcase_04 AC 113 ms
15,248 KB
testcase_05 AC 377 ms
15,532 KB
testcase_06 AC 259 ms
15,692 KB
testcase_07 AC 84 ms
15,328 KB
testcase_08 AC 79 ms
15,068 KB
testcase_09 AC 4,115 ms
18,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets
l=$<.map{|s|s.split.map &:to_i}.sort_by{|e|-e[-1]}
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.take_while{|e|x,y,v=*e;s-=h[x]<h[y]?0:v;s>m};m=[m,s].max
}
p m
0