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 Python (3.4.3)
Score 600
Code Size 396 Byte
Status AC
Exec Time 301 ms
Memory 12484 KB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 3
AC × 23
Set Name Test Cases
sample sample01, sample02, sample03
All 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 AC 149 ms 12388 KB
12 AC 153 ms 12388 KB
13 AC 153 ms 12388 KB
14 AC 152 ms 12388 KB
15 AC 150 ms 12388 KB
21 AC 276 ms 12388 KB
22 AC 225 ms 12388 KB
23 AC 236 ms 12388 KB
24 AC 291 ms 12484 KB
25 AC 171 ms 12388 KB
31 AC 301 ms 12388 KB
32 AC 297 ms 12388 KB
33 AC 296 ms 12388 KB
34 AC 298 ms 12388 KB
35 AC 298 ms 12388 KB
41 AC 299 ms 12388 KB
42 AC 299 ms 12484 KB
43 AC 299 ms 12388 KB
44 AC 300 ms 12388 KB
45 AC 300 ms 12388 KB
sample01 AC 149 ms 12388 KB
sample02 AC 149 ms 12388 KB
sample03 AC 150 ms 12388 KB