結果
問題 | No.798 コレクション |
ユーザー | tomarint2 |
提出日時 | 2019-03-15 23:24:48 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 347 bytes |
コンパイル時間 | 75 ms |
コンパイル使用メモリ | 10,408 KB |
実行使用メモリ | 7,876 KB |
最終ジャッジ日時 | 2023-09-14 14:21:09 |
合計ジャッジ時間 | 5,143 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
7,728 KB |
testcase_01 | AC | 16 ms
7,792 KB |
testcase_02 | AC | 29 ms
7,820 KB |
testcase_03 | AC | 15 ms
7,724 KB |
testcase_04 | AC | 15 ms
7,788 KB |
testcase_05 | AC | 16 ms
7,708 KB |
testcase_06 | AC | 14 ms
7,716 KB |
testcase_07 | AC | 17 ms
7,876 KB |
testcase_08 | AC | 31 ms
7,720 KB |
testcase_09 | AC | 432 ms
7,784 KB |
testcase_10 | AC | 414 ms
7,784 KB |
testcase_11 | AC | 30 ms
7,792 KB |
testcase_12 | AC | 16 ms
7,768 KB |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
ソースコード
N=int(input()) a=[0]*N b=[0]*N for i in range(N): a[i],b[i]=map(int,input().split()) def buy(n, history): if n == (N+1)*2//3: return 0 cost = [] for i in range(N): if (history & (1 << i)) != 0: continue cost.append(a[i]+b[i]*n + buy(n+1, history|(1<<i))) return min(cost) print(buy(0, 0))