結果

問題 No.2215 Slide Subset Sum
ユーザー vwxyzvwxyz
提出日時 2023-09-06 19:40:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,496 bytes
コンパイル時間 1,394 ms
コンパイル使用メモリ 86,524 KB
実行使用メモリ 438,676 KB
最終ジャッジ日時 2023-09-06 19:41:43
合計ジャッジ時間 53,733 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 637 ms
166,836 KB
testcase_01 WA -
testcase_02 AC 1,997 ms
437,252 KB
testcase_03 AC 1,949 ms
437,648 KB
testcase_04 AC 1,953 ms
437,488 KB
testcase_05 AC 259 ms
91,268 KB
testcase_06 AC 263 ms
91,492 KB
testcase_07 WA -
testcase_08 AC 259 ms
91,324 KB
testcase_09 AC 264 ms
91,068 KB
testcase_10 AC 267 ms
91,384 KB
testcase_11 AC 269 ms
91,380 KB
testcase_12 AC 277 ms
94,276 KB
testcase_13 AC 278 ms
95,128 KB
testcase_14 AC 276 ms
94,336 KB
testcase_15 AC 259 ms
91,096 KB
testcase_16 AC 295 ms
95,668 KB
testcase_17 AC 1,763 ms
437,548 KB
testcase_18 AC 1,813 ms
437,484 KB
testcase_19 AC 1,943 ms
438,364 KB
testcase_20 AC 1,707 ms
437,716 KB
testcase_21 AC 1,908 ms
438,436 KB
testcase_22 AC 1,686 ms
437,576 KB
testcase_23 AC 1,522 ms
437,380 KB
testcase_24 AC 1,522 ms
436,892 KB
testcase_25 AC 1,564 ms
436,864 KB
testcase_26 AC 1,685 ms
437,464 KB
testcase_27 AC 346 ms
107,652 KB
testcase_28 AC 341 ms
111,964 KB
testcase_29 AC 386 ms
119,268 KB
testcase_30 AC 950 ms
252,128 KB
testcase_31 AC 658 ms
215,072 KB
testcase_32 AC 425 ms
125,284 KB
testcase_33 AC 1,246 ms
307,736 KB
testcase_34 AC 994 ms
272,088 KB
testcase_35 AC 441 ms
121,932 KB
testcase_36 AC 527 ms
164,268 KB
testcase_37 AC 1,451 ms
436,752 KB
testcase_38 AC 348 ms
144,720 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 267 ms
91,336 KB
testcase_42 AC 1,717 ms
437,520 KB
testcase_43 AC 1,897 ms
438,676 KB
testcase_44 AC 1,905 ms
438,084 KB
testcase_45 AC 1,593 ms
436,976 KB
testcase_46 AC 1,613 ms
436,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()))
mod=998244353
left=[[0]*K for i in range(N+1)]
right=[[0]*K for i in range(N+1)]
left[0][0]=1
right[N][0]=1
for i in range(1,N+1):
    if i%M==1:
        left[i][0]+=1
        left[i][A[i-1]%K]+=1
    else:
        for k in range(K):
            left[i][k]+=left[i-1][k]
            left[i][k]+=left[i-1][(k-A[i-1])%K]
            left[i][k]%=mod
for i in range(N-1,-1,-1):
    if i%M==0:
        right[i][0]=1
    else:
        for k in range(K):
            right[i][k]+=right[i+1][k]
            right[i][k]+=right[i+1][(k-A[i])%K]
            right[i][k]%=mod
for i in range(N-M+1):
    ans=(sum(right[i][k]*left[i+M][(-k)%K]%mod for k in range(K))-1)%mod
    print(ans)
0