Submission #13630739


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+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 406 Byte
Status
Exec Time 806 ms
Memory 286216 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 163 ms 38256 KB
02.txt 164 ms 38256 KB
03.txt 166 ms 38256 KB
04.txt 165 ms 38256 KB
05.txt 164 ms 38256 KB
06.txt 163 ms 38256 KB
07.txt 168 ms 38256 KB
08.txt 165 ms 38256 KB
09.txt 422 ms 151432 KB
10.txt 655 ms 228616 KB
11.txt 169 ms 39152 KB
12.txt 163 ms 38256 KB
13.txt 163 ms 38256 KB
14.txt 168 ms 38384 KB
15.txt 165 ms 38256 KB
16.txt 161 ms 38256 KB
17.txt 380 ms 127240 KB
18.txt 349 ms 120156 KB
19.txt 802 ms 277640 KB
20.txt 806 ms 286216 KB
21.txt 166 ms 38640 KB
s1.txt 164 ms 38256 KB
s2.txt 165 ms 38256 KB
s3.txt 162 ms 38256 KB