結果

問題 No.2329 Nafmo、イカサマをする
ユーザー pありpあり
提出日時 2023-05-28 15:17:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 353 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 659 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 108,056 KB
最終ジャッジ日時 2023-08-27 11:50:22
合計ジャッジ時間 8,085 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,572 KB
testcase_01 AC 94 ms
71,460 KB
testcase_02 AC 90 ms
71,392 KB
testcase_03 AC 90 ms
71,768 KB
testcase_04 AC 92 ms
71,636 KB
testcase_05 AC 91 ms
71,460 KB
testcase_06 AC 90 ms
71,576 KB
testcase_07 AC 91 ms
71,460 KB
testcase_08 AC 112 ms
77,792 KB
testcase_09 AC 93 ms
71,576 KB
testcase_10 AC 97 ms
77,044 KB
testcase_11 AC 98 ms
77,124 KB
testcase_12 AC 106 ms
77,168 KB
testcase_13 AC 107 ms
77,748 KB
testcase_14 AC 98 ms
77,292 KB
testcase_15 AC 103 ms
77,444 KB
testcase_16 AC 103 ms
76,284 KB
testcase_17 AC 97 ms
76,880 KB
testcase_18 AC 106 ms
77,712 KB
testcase_19 AC 138 ms
82,436 KB
testcase_20 AC 115 ms
78,452 KB
testcase_21 AC 141 ms
83,704 KB
testcase_22 AC 112 ms
77,768 KB
testcase_23 AC 124 ms
85,376 KB
testcase_24 AC 104 ms
78,876 KB
testcase_25 AC 115 ms
77,668 KB
testcase_26 AC 102 ms
78,092 KB
testcase_27 AC 106 ms
77,968 KB
testcase_28 AC 103 ms
77,212 KB
testcase_29 AC 124 ms
78,172 KB
testcase_30 AC 113 ms
77,412 KB
testcase_31 AC 125 ms
86,244 KB
testcase_32 AC 102 ms
77,400 KB
testcase_33 AC 107 ms
77,676 KB
testcase_34 AC 113 ms
79,268 KB
testcase_35 AC 119 ms
77,840 KB
testcase_36 AC 191 ms
92,252 KB
testcase_37 AC 133 ms
81,552 KB
testcase_38 AC 201 ms
107,100 KB
testcase_39 AC 264 ms
107,020 KB
testcase_40 AC 258 ms
108,040 KB
testcase_41 AC 353 ms
107,500 KB
testcase_42 AC 256 ms
108,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import bisect
import heapq

n,m,k = map(int, input().split())


a = list(map(int, input().split()))

s = [set() for _ in range(4)]
s[0].add(0)

for i1 in range(n):
  now1 = a[i1]
  s[1].add(now1)
  for i2 in range(n):
    now2 = now1+a[i2]
    s[2].add(now2)
    for i3 in range(n):
      s[3].add(now2+a[i3])
  
for i in range(4):
  s[i] = list(s[i])
  s[i].sort()

ans = 0
for k1 in range(4):
  for k2 in range(4):
    if(k1+k2<=k):
      for a1 in s[k1]:
        b = m-a1
        i = bisect.bisect(s[k2],b)-1
        now = a1+s[k2][i]
        if(now<=m):
          ans = max(ans, now)
        
print(ans)
  
  
  

      




0