Problem p02780 (python)

Fixed submission:
N, K = map(int, input().split())
num = list(map(int, input().split()))
 
# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)
 
# 累積和を作る
cs = [0]
for i in range(N):
    cs.append(cs[i]+expect[i])

max = 0
for i in range(K, N+1): # 配列0番目に初期値0が増えてるので1足す
  if max < cs[i] - cs[i-K]:
    max = cs[i] - cs[i - K]
print(max)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
num = list(map(int, input().split()))
 
# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)
  print(expect)
 
# 累積和を作る
cs = [0]
for (i, number) in enumerate(expect):
  cs.append(cs[i] + expect[i])

for i in range(K, N+1): # 配列0番目に初期値0が増えてるので1足す
  if max < cs[i] - cs[i-K]:
    max = cs[i] - cs[i - K]
print(max)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
num = list(map(int, input().split()))
 
# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)
  print(expect)
 
# 累積和を作る
cs = [0]
for i in range(N):
    cs.append(cs[i]+expect[i])
    print(cs)

for i in range(K, N+1): # 配列0番目に初期値0が増えてるので1足す
  if max < cs[i] - cs[i-K]:
    max = cs[i] - cs[i - K]
print(max)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))

for i in range(n-k):
    if max(l[i:i+k]) < l[i+k]:
        m=l[i+1:i+k+1]
    else:
        m=l[i:i+k]

result=float(0)
for i in range(len(m)):
    t=m[i]
    if t%2==0:
        result += (1+t)*(t/2)/t
    else:
        result += ((1+t)*(t//2)+(t//2+1))/t
    
print(result)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))

for i in range(n-k):
    if max(l[i:i+k]) < l[i+k]:
        m=l[i+1:i+k+1]
    else:
        m=l[i:i+k]

result=float(0)
for i in range(len(m)):
    t=m[i]
    if t%2==0:
        result += (1+t)*(t/2)/t
    else:
        result += ((1+t)*(t//2)+(t//2+1))/t
    
print(result)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))

for i in range(n-k):
    if max(l[i:i+k-1]) < l[i+k]:
        m=l[i+1:i+k+1]
    else:
        m=l[i:i+k]

result=float(0)
for i in range(len(m)):
    t=m[i]
    if t%2==0:
        result += (1+t)*(t/2)/t
    else:
        result += ((1+t)*(t//2)+(t//2+1))/t
    
print(result)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))

for i in range(n-k):
    if sum(l[i:i+k]) < sum(l[i+1:i+k+1]):
        max=l[i+1:i+k+1]
    else:
        max=l[i:i+k]

result=float(0)
for i in range(len(max)):
    t=max[i]
    if t%2==0:
        result += (1+t)*(t/2)/t
    else:
        result += ((1+t)*(t//2)+(t//2+1))/t
    
print(result)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))

for i in range(n-k):
    if sum(l[i:i+k]) < sum(l[i+1:i+k+1]):
        max=l[i+1:i+k+1]
    else:
        max=l[i:i+k]

result=float(0)
for i in range(len(max)):
    t=max[i]
    if t%2==0:
        result += (1+t)*(t/2)/t
    else:
        result += ((1+t)*(t//2)+(t//2+1))/t
    
print(result)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))

for i in range(n-k):
    if sum(l[i:i+k]) < sum(l[i+1:i+k+1]):
        max=l[i+1:i+k+1]
    else:
        max=l[i:i+k]

result=float(0)
for i in range(len(max)):
    t=max[i]
    if t%2==0:
        result += (1+t)*(t/2)/t
    else:
        result += ((1+t)*(t//2)+(t//2+1))/t
    
    print(result)