結果
問題 | No.115 遠足のおやつ |
ユーザー | terasa |
提出日時 | 2022-06-07 17:21:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,425 bytes |
コンパイル時間 | 298 ms |
コンパイル使用メモリ | 81,804 KB |
実行使用メモリ | 66,464 KB |
最終ジャッジ日時 | 2023-10-21 03:50:54 |
合計ジャッジ時間 | 4,270 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
55,564 KB |
testcase_01 | AC | 52 ms
61,692 KB |
testcase_02 | WA | - |
testcase_03 | AC | 50 ms
61,544 KB |
testcase_04 | WA | - |
testcase_05 | AC | 45 ms
55,564 KB |
testcase_06 | AC | 45 ms
55,564 KB |
testcase_07 | AC | 54 ms
61,624 KB |
testcase_08 | AC | 50 ms
61,544 KB |
testcase_09 | AC | 51 ms
61,544 KB |
testcase_10 | AC | 49 ms
61,544 KB |
testcase_11 | AC | 48 ms
61,468 KB |
testcase_12 | AC | 50 ms
61,468 KB |
testcase_13 | AC | 46 ms
55,564 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 57 ms
64,144 KB |
testcase_18 | AC | 46 ms
55,564 KB |
testcase_19 | AC | 55 ms
64,104 KB |
testcase_20 | AC | 54 ms
64,104 KB |
testcase_21 | AC | 50 ms
61,468 KB |
testcase_22 | WA | - |
testcase_23 | AC | 56 ms
63,836 KB |
testcase_24 | WA | - |
testcase_25 | AC | 59 ms
64,144 KB |
testcase_26 | AC | 54 ms
64,104 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 55 ms
64,108 KB |
testcase_30 | WA | - |
testcase_31 | AC | 54 ms
64,104 KB |
testcase_32 | WA | - |
testcase_33 | AC | 53 ms
63,672 KB |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | AC | 66 ms
66,196 KB |
testcase_40 | AC | 46 ms
55,564 KB |
testcase_41 | AC | 46 ms
55,564 KB |
testcase_42 | AC | 46 ms
55,564 KB |
ソースコード
import sys import pypyjit import itertools import heapq import math from collections import deque, defaultdict import bisect input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) pypyjit.set_param('max_unroll_recursion=-1') def index_lt(a, x): 'return largest index s.t. A[i] < x or -1 if it does not exist' return bisect.bisect_left(a, x) - 1 def index_le(a, x): 'return largest index s.t. A[i] <= x or -1 if it does not exist' return bisect.bisect_right(a, x) - 1 def index_gt(a, x): 'return smallest index s.t. A[i] > x or len(a) if it does not exist' return bisect.bisect_right(a, x) def index_ge(a, x): 'return smallest index s.t. A[i] >= x or len(a) if it does not exist' return bisect.bisect_left(a, x) N, D, K = map(int, input().split()) dp = [[False for _ in range(D + 1)] for _ in range(K + 1)] pre = [[0 for _ in range(D + 1)] for _ in range(K + 1)] dp[0][0] = True for i in range(1, N + 1): for j in range(K, 0, -1): for k in range(D, 0, -1): if k - i < 0: break if dp[j - 1][k - i] is False: continue dp[j][k] = True pre[j][k] = max(pre[j][k], i) if dp[K][D] is False: print(-1) else: ans = [] cnt = K price = D for _ in range(K): p = pre[cnt][price] ans.append(p) cnt -= 1 price -= p ans.reverse() print(*ans)