結果

問題 No.2329 Nafmo、イカサマをする
ユーザー ntudantuda
提出日時 2023-06-10 20:41:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 565 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 86,280 KB
実行使用メモリ 89,276 KB
最終ジャッジ日時 2023-08-31 00:46:44
合計ジャッジ時間 5,774 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
70,812 KB
testcase_01 AC 58 ms
71,036 KB
testcase_02 AC 60 ms
70,936 KB
testcase_03 AC 64 ms
70,880 KB
testcase_04 AC 59 ms
70,564 KB
testcase_05 AC 59 ms
71,084 KB
testcase_06 AC 59 ms
70,844 KB
testcase_07 AC 57 ms
70,740 KB
testcase_08 AC 67 ms
76,016 KB
testcase_09 AC 61 ms
71,212 KB
testcase_10 AC 63 ms
75,800 KB
testcase_11 AC 63 ms
75,456 KB
testcase_12 AC 56 ms
70,848 KB
testcase_13 AC 62 ms
75,184 KB
testcase_14 AC 58 ms
71,020 KB
testcase_15 AC 64 ms
75,516 KB
testcase_16 AC 61 ms
71,112 KB
testcase_17 AC 60 ms
71,028 KB
testcase_18 AC 63 ms
75,064 KB
testcase_19 AC 75 ms
76,472 KB
testcase_20 AC 67 ms
75,608 KB
testcase_21 AC 67 ms
75,328 KB
testcase_22 AC 64 ms
76,000 KB
testcase_23 AC 67 ms
75,444 KB
testcase_24 WA -
testcase_25 AC 81 ms
75,512 KB
testcase_26 WA -
testcase_27 AC 66 ms
75,704 KB
testcase_28 AC 66 ms
75,384 KB
testcase_29 AC 70 ms
75,668 KB
testcase_30 AC 63 ms
75,464 KB
testcase_31 WA -
testcase_32 AC 59 ms
70,852 KB
testcase_33 AC 67 ms
75,680 KB
testcase_34 AC 66 ms
75,644 KB
testcase_35 AC 64 ms
75,316 KB
testcase_36 AC 75 ms
75,932 KB
testcase_37 AC 68 ms
75,556 KB
testcase_38 AC 88 ms
88,216 KB
testcase_39 AC 78 ms
77,908 KB
testcase_40 AC 85 ms
82,556 KB
testcase_41 AC 113 ms
89,276 KB
testcase_42 AC 86 ms
82,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K = map(int,input().split())
A = list(map(int,input().split())) + [0]

S = [set() for _ in range(7)]
S[0] = {0}
S[1] = set(A)

for i in range(2,4):
    for a in S[1]:
        for b in S[i-1]:
            d = a + b
            if d <= M:
                S[i].add(d)

if K < 4:
    print(max(S[K]))
    exit()

i = K // 2
j = K - i
S1 = list(S[i])
S1.sort()
S2 = list(S[j])
S2.sort(reverse = True)
NS2 = len(S2)
i = 0
ans = 0
for a in S1:
    while i < NS2 and a + S2[i] > M:
        i += 1
    ans = max(ans,a + S2[i])
    if i == NS2:
        break

print(ans)
0