Submission #13630796


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] == float('inf'): 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 466 Byte
Status
Exec Time 2121 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 165 ms 38256 KB
02.txt 165 ms 38256 KB
03.txt 166 ms 38256 KB
04.txt 165 ms 38256 KB
05.txt 166 ms 38256 KB
06.txt 168 ms 38256 KB
07.txt 168 ms 38256 KB
08.txt 167 ms 38256 KB
09.txt 2121 ms 279944 KB
10.txt 2119 ms 269192 KB
11.txt 211 ms 42352 KB
12.txt 167 ms 38256 KB
13.txt 167 ms 38256 KB
14.txt 168 ms 38256 KB
15.txt 168 ms 38256 KB
16.txt 166 ms 38256 KB
17.txt 1558 ms 289288 KB
18.txt 1598 ms 289288 KB
19.txt 1998 ms 291208 KB
20.txt 2016 ms 290440 KB
21.txt 172 ms 38640 KB
s1.txt 166 ms 38256 KB
s2.txt 165 ms 38256 KB
s3.txt 168 ms 38256 KB