結果

問題 No.2329 Nafmo、イカサマをする
ユーザー kemunikukemuniku
提出日時 2023-05-28 15:24:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 744 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 140,824 KB
最終ジャッジ日時 2023-08-27 12:04:59
合計ジャッジ時間 5,839 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,324 KB
testcase_01 AC 72 ms
71,292 KB
testcase_02 AC 71 ms
71,220 KB
testcase_03 AC 71 ms
71,392 KB
testcase_04 AC 73 ms
71,124 KB
testcase_05 AC 72 ms
71,292 KB
testcase_06 AC 71 ms
71,356 KB
testcase_07 AC 72 ms
71,428 KB
testcase_08 AC 92 ms
76,664 KB
testcase_09 AC 74 ms
71,240 KB
testcase_10 AC 73 ms
71,320 KB
testcase_11 AC 74 ms
71,272 KB
testcase_12 AC 74 ms
71,352 KB
testcase_13 AC 76 ms
71,244 KB
testcase_14 AC 76 ms
71,336 KB
testcase_15 AC 75 ms
71,416 KB
testcase_16 AC 76 ms
71,284 KB
testcase_17 AC 75 ms
71,148 KB
testcase_18 AC 80 ms
71,132 KB
testcase_19 AC 94 ms
76,268 KB
testcase_20 AC 88 ms
76,928 KB
testcase_21 AC 81 ms
76,056 KB
testcase_22 AC 85 ms
76,532 KB
testcase_23 AC 75 ms
71,348 KB
testcase_24 AC 75 ms
70,928 KB
testcase_25 AC 80 ms
75,900 KB
testcase_26 AC 77 ms
70,920 KB
testcase_27 AC 79 ms
71,236 KB
testcase_28 AC 77 ms
71,372 KB
testcase_29 AC 101 ms
77,088 KB
testcase_30 AC 76 ms
71,432 KB
testcase_31 AC 75 ms
71,324 KB
testcase_32 AC 75 ms
71,368 KB
testcase_33 AC 75 ms
71,428 KB
testcase_34 AC 77 ms
71,364 KB
testcase_35 AC 81 ms
76,600 KB
testcase_36 AC 165 ms
106,500 KB
testcase_37 AC 79 ms
75,612 KB
testcase_38 AC 73 ms
71,276 KB
testcase_39 AC 170 ms
108,792 KB
testcase_40 AC 93 ms
76,364 KB
testcase_41 AC 268 ms
140,824 KB
testcase_42 AC 92 ms
76,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
A.append(0)
x = K//2
y = K-x
if x == 0:
    one = [0]
else:
    old = A[:]
    for i in range(x-1):
        new = set()
        for i in range(len(old)):
            for j in range(N+1):
                new.add(old[i]+A[j])
        old = list(new)
    one = old
old = A[:]
for i in range(y-1):
    new = set()
    for i in range(len(old)):
        for j in range(N+1):
            new.add(old[i]+A[j])
    old = list(new)
two = old
one.sort()
two.sort()
ans = 0
for i in one:
    if M-i >= 0:
        index = bisect.bisect_right(two,M-i)-1
        if index != len(two):
            if two[index] + i <= M:
                ans = max(ans,two[index] + i)
print(ans)
0