結果

問題 No.269 見栄っ張りの募金活動
ユーザー vwxyzvwxyz
提出日時 2023-04-22 06:51:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 166 ms / 5,000 ms
コード長 936 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 105,344 KB
最終ジャッジ日時 2024-04-24 13:34:20
合計ジャッジ時間 4,774 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
89,728 KB
testcase_01 AC 141 ms
89,728 KB
testcase_02 AC 145 ms
90,368 KB
testcase_03 AC 139 ms
90,368 KB
testcase_04 AC 150 ms
95,488 KB
testcase_05 AC 141 ms
90,368 KB
testcase_06 AC 137 ms
89,728 KB
testcase_07 AC 166 ms
105,344 KB
testcase_08 AC 137 ms
89,856 KB
testcase_09 AC 153 ms
90,368 KB
testcase_10 AC 142 ms
90,240 KB
testcase_11 AC 149 ms
91,264 KB
testcase_12 AC 147 ms
90,496 KB
testcase_13 AC 149 ms
90,112 KB
testcase_14 AC 143 ms
90,368 KB
testcase_15 AC 144 ms
90,368 KB
testcase_16 AC 149 ms
90,240 KB
testcase_17 AC 147 ms
90,368 KB
testcase_18 AC 154 ms
99,328 KB
testcase_19 AC 143 ms
90,496 KB
testcase_20 AC 148 ms
90,368 KB
testcase_21 AC 143 ms
90,240 KB
testcase_22 AC 143 ms
90,368 KB
testcase_23 AC 138 ms
90,240 KB
testcase_24 AC 140 ms
90,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import functools
import heapq
import itertools
import math
import random
import sys
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
N,S,K=map(int,readline().split())
mod=10**9+7
dp=[0]*(S+1)
dp[0]=1
for n in range(1,N+1):
    prev=dp
    dp=[0]*(S+1)
    for s in range(K*(n-1),S+1):
        if s>=n:
            dp[s]=dp[s-n]
        dp[s]+=prev[s-K*(n-1)]
        dp[s]%=mod
ans=dp[S]
print(ans)
0