Submission #13630771


Source Code Expand

Copy
N,M,L,X = map(int,input().split())
dp = [ [float('inf')]*(M) for _ in range(N+1) ]
dp[0][0] = 1
A = list(map(int,input().split()))

for i in range(N):
  for j in range(M):
    if dp[i][j] > X: continue

    a = A[i]
    # if j == a:
    #   dp[i+1][j] = min(dp[i+1][j], 1)
    dp[i+1][j] = min(dp[i+1][j], dp[i][j])
    dp[i+1][(j+a)%M] = min(dp[i][(j+a)%M], dp[i][j]+((j+a)//M))

if dp[-1][L] <= X:
  print("Yes")
else:
  print("No")

Submission Info

Submission Time
Task D - Many Go Round
User takin16
Language PyPy3 (2.4.0)
Score 0
Code Size 454 Byte
Status
Exec Time 1499 ms
Memory 291208 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 0 / 100 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 168 ms 38384 KB
02.txt 162 ms 38256 KB
03.txt 160 ms 38256 KB
04.txt 163 ms 38256 KB
05.txt 160 ms 38256 KB
06.txt 160 ms 38256 KB
07.txt 161 ms 38256 KB
08.txt 160 ms 38256 KB
09.txt 1499 ms 291208 KB
10.txt 1482 ms 288648 KB
11.txt 170 ms 39536 KB
12.txt 159 ms 38256 KB
13.txt 159 ms 38256 KB
14.txt 159 ms 38256 KB
15.txt 160 ms 38256 KB
16.txt 160 ms 38256 KB
17.txt 865 ms 285960 KB
18.txt 742 ms 282248 KB
19.txt 1233 ms 286984 KB
20.txt 1301 ms 288392 KB
21.txt 164 ms 38640 KB
s1.txt 160 ms 38256 KB
s2.txt 159 ms 38256 KB
s3.txt 161 ms 38256 KB