結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー | vwxyz |
提出日時 | 2023-04-22 06:51:06 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,292 ms / 5,000 ms |
コード長 | 936 bytes |
コンパイル時間 | 94 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 13,296 KB |
最終ジャッジ日時 | 2024-04-24 13:34:14 |
合計ジャッジ時間 | 7,222 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
11,648 KB |
testcase_01 | AC | 43 ms
11,648 KB |
testcase_02 | AC | 51 ms
11,776 KB |
testcase_03 | AC | 126 ms
11,904 KB |
testcase_04 | AC | 498 ms
13,160 KB |
testcase_05 | AC | 42 ms
11,904 KB |
testcase_06 | AC | 41 ms
11,776 KB |
testcase_07 | AC | 1,292 ms
13,296 KB |
testcase_08 | AC | 41 ms
11,776 KB |
testcase_09 | AC | 548 ms
12,416 KB |
testcase_10 | AC | 43 ms
11,648 KB |
testcase_11 | AC | 169 ms
13,160 KB |
testcase_12 | AC | 442 ms
12,544 KB |
testcase_13 | AC | 189 ms
12,416 KB |
testcase_14 | AC | 67 ms
12,776 KB |
testcase_15 | AC | 178 ms
12,544 KB |
testcase_16 | AC | 398 ms
12,416 KB |
testcase_17 | AC | 109 ms
11,904 KB |
testcase_18 | AC | 782 ms
12,928 KB |
testcase_19 | AC | 228 ms
12,416 KB |
testcase_20 | AC | 73 ms
12,160 KB |
testcase_21 | AC | 73 ms
13,056 KB |
testcase_22 | AC | 132 ms
12,032 KB |
testcase_23 | AC | 61 ms
11,904 KB |
testcase_24 | AC | 86 ms
12,672 KB |
ソースコード
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)