Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
  break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
a_timelist = int(input().split())
b_timelist = int(input().split())
counta = len(a_timelist)
countb = len(b_timelist)
time = 0
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + a_timelist[i])
for i in range(M):
  b.append(b[i] + b_timelist[i])
ans, j = 0, M
for i in range(N+1):
  if a[i] > K:
    break
  while b[i] > K -a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
N, M, K = int(input().split())
a_timelist = int(input().split())
b_timelist = int(input().split())
counta = len(a_timelist)
countb = len(b_timelist)
time = 0
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + a_timelist[i])
for i in range(M):
  b.append(b[i] + b_timelist[i])
ans, j = 0, M
for i in range(N+1):
  if a[i] > K:
    break
  while b[i] > K -a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
提出情報

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, (input().split()))
a_timelist = int(input().split())
b_timelist = int(input().split())
counta = len(a_timelist)
countb = len(b_timelist)
time = 0
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + a_timelist[i])
for i in range(M):
  b.append(b[i] + b_timelist[i])
ans, j = 0, M
for i in range(N+1):
  if a[i] > K:
    break
  while b[i] > K -a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
N, M, K = int(input().split())
a_timelist = int(input().split())
b_timelist = int(input().split())
counta = len(a_timelist)
countb = len(b_timelist)
time = 0
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + a_timelist[i])
for i in range(M):
  b.append(b[i] + b_timelist[i])
ans, j = 0, M
for i in range(N+1):
  if a[i] > K:
    break
  while b[i] > K -a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = int(input().split())
a_timelist = int(input().split())
b_timelist = int(input().split())
counta = len(a_timelist)
countb = len(b_timelist)
time = 0
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + a_timelist[i])
for i in range(M):
  b.append(b[i] + b_timelist[i])
ans, j = 0, M
for i in range(N+1):
  if a[i] > K:
    break
  while b[i] > K -a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = input().split()
a_timelist = input().split()
b_timelist = input().split()
N, M, K = int(N), int(M), int(K)
a_timelist = [int(x) for x in a_timelist]
b_timelist = [int(x) for x in b_timelist]
counta = len(a_timelist)
countb = len(b_timelist)
counter = 0
time = 0
if a_timelist[0] > K and b_timelist[0] > K:
  print(0)
  exit()
while time <= K:
  if a_timelist == [] and b_timelist == []:
    print(counta + countb)
    exit()
  if (b_timelist == [] and a_timelist != []) or (a_timelist[0] >= b_timelist[0]):
    time += a_timelist[0]
    counter += 1
    del a_timelist[0]
  elif (a_timelist == [] and b_timelist != []) or (a_timelist[0] <= b_timelist[0]):
    time += b_timelist[0]
    counter += 1
    del b_timelist[0]
print(counter)