結果
問題 | No.19 ステージの選択 |
ユーザー | letrangerjp |
提出日時 | 2017-06-03 13:15:21 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 355 bytes |
コンパイル時間 | 797 ms |
コンパイル使用メモリ | 11,896 KB |
実行使用メモリ | 31,096 KB |
最終ジャッジ日時 | 2023-10-22 02:56:29 |
合計ジャッジ時間 | 8,483 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge9 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 91 ms
16,112 KB |
testcase_01 | AC | 90 ms
16,104 KB |
testcase_02 | AC | 91 ms
16,104 KB |
testcase_03 | AC | 298 ms
17,468 KB |
testcase_04 | TLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i LS = N.times.map{ a,b = gets.split.take(2).map(&:to_i) [a*2, b-1] } $dp = {} def f(x) $dp[x] ||= if x == 0 0 else (0..x.bit_length-1).map{|a| if x[a] == 0 1.0/0 else l, s = LS[a] l /= 2 if s != a && ((1<<s)&x) != 0 l + f(1<<a^x) end }.min end end p f(2**N-1).fdiv(2)