結果
問題 | No.2329 Nafmo、イカサマをする |
ユーザー | vwxyz |
提出日時 | 2023-09-10 21:30:36 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,164 bytes |
コンパイル時間 | 417 ms |
コンパイル使用メモリ | 87,348 KB |
実行使用メモリ | 127,832 KB |
最終ジャッジ日時 | 2023-09-10 21:30:58 |
合計ジャッジ時間 | 20,454 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 274 ms
93,168 KB |
testcase_01 | AC | 358 ms
97,596 KB |
testcase_02 | AC | 285 ms
93,000 KB |
testcase_03 | AC | 283 ms
93,304 KB |
testcase_04 | AC | 290 ms
93,368 KB |
testcase_05 | AC | 281 ms
93,468 KB |
testcase_06 | AC | 286 ms
93,376 KB |
testcase_07 | AC | 290 ms
93,180 KB |
testcase_08 | AC | 370 ms
97,380 KB |
testcase_09 | AC | 289 ms
93,352 KB |
testcase_10 | AC | 283 ms
93,308 KB |
testcase_11 | AC | 288 ms
93,480 KB |
testcase_12 | AC | 299 ms
95,524 KB |
testcase_13 | AC | 309 ms
95,488 KB |
testcase_14 | AC | 287 ms
93,368 KB |
testcase_15 | AC | 280 ms
93,184 KB |
testcase_16 | AC | 319 ms
96,588 KB |
testcase_17 | AC | 282 ms
93,372 KB |
testcase_18 | AC | 316 ms
96,724 KB |
testcase_19 | AC | 340 ms
97,120 KB |
testcase_20 | AC | 401 ms
97,840 KB |
testcase_21 | AC | 342 ms
97,056 KB |
testcase_22 | AC | 376 ms
97,332 KB |
testcase_23 | AC | 280 ms
93,168 KB |
testcase_24 | AC | 293 ms
93,364 KB |
testcase_25 | AC | 329 ms
97,008 KB |
testcase_26 | AC | 283 ms
93,280 KB |
testcase_27 | AC | 289 ms
93,380 KB |
testcase_28 | AC | 289 ms
93,316 KB |
testcase_29 | AC | 434 ms
97,952 KB |
testcase_30 | AC | 320 ms
96,796 KB |
testcase_31 | AC | 293 ms
93,164 KB |
testcase_32 | AC | 322 ms
97,408 KB |
testcase_33 | AC | 274 ms
93,376 KB |
testcase_34 | AC | 282 ms
93,424 KB |
testcase_35 | AC | 349 ms
97,584 KB |
testcase_36 | AC | 1,239 ms
110,868 KB |
testcase_37 | AC | 308 ms
96,348 KB |
testcase_38 | AC | 285 ms
93,272 KB |
testcase_39 | AC | 1,678 ms
97,936 KB |
testcase_40 | AC | 335 ms
97,452 KB |
testcase_41 | TLE | - |
testcase_42 | AC | 330 ms
97,472 KB |
ソースコード
import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys import time from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines write=sys.stdout.write #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') N,M,K=map(int,readline().split()) A=list(map(int,readline().split())) se=set() for tpl in itertools.product(A,repeat=K//2): for i in range(K//2+1): se.add(sum(tpl[:i])) lst=list(se) lst.sort() ans=0 for tpl in itertools.product(A,repeat=K-K//2): for i in range((K-K//2)+1): a=sum(tpl[:i]) i=bisect.bisect_right(lst,M-a) if i: ans=max(ans,a+lst[i-1]) print(ans)