結果
| 問題 |
No.2329 Nafmo、イカサマをする
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2023-06-10 20:41:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 565 bytes |
| コンパイル時間 | 215 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 78,080 KB |
| 最終ジャッジ日時 | 2025-01-03 01:29:03 |
| 合計ジャッジ時間 | 3,871 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 WA * 3 |
ソースコード
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)
ntuda