Submission #11120535


Source Code Expand

Copy
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

MOD = 998244353

N, S, *As = map(int, read().split())

U = 3010
answer = 0
f = np.zeros(U, np.int64)
for A in As:
    f[0] += 1
    f[A:] += f[:-A].copy()
    f %= MOD
    answer += f[S]

answer %= MOD
print(answer)

Submission Info

Submission Time
Task F - Knapsack for All Segments
User maspy
Language Python3 (3.4.3)
Score 600
Code Size 396 Byte
Status
Exec Time 301 ms
Memory 12484 KB

Judge Result

Set Name Score / Max Score Test Cases
sample 0 / 0 sample01, sample02, sample03
All 600 / 600 11, 12, 13, 14, 15, 21, 22, 23, 24, 25, 31, 32, 33, 34, 35, 41, 42, 43, 44, 45, sample01, sample02, sample03
Case Name Status Exec Time Memory
11 149 ms 12388 KB
12 153 ms 12388 KB
13 153 ms 12388 KB
14 152 ms 12388 KB
15 150 ms 12388 KB
21 276 ms 12388 KB
22 225 ms 12388 KB
23 236 ms 12388 KB
24 291 ms 12484 KB
25 171 ms 12388 KB
31 301 ms 12388 KB
32 297 ms 12388 KB
33 296 ms 12388 KB
34 298 ms 12388 KB
35 298 ms 12388 KB
41 299 ms 12388 KB
42 299 ms 12484 KB
43 299 ms 12388 KB
44 300 ms 12388 KB
45 300 ms 12388 KB
sample01 149 ms 12388 KB
sample02 149 ms 12388 KB
sample03 150 ms 12388 KB