Problem p02647 (python)

Fixed submission:
import numpy as np
from numba import njit

@njit #処理の並列化

def imos(n, a):
    
    l=np.zeros((n+1), dtype = np.int64)

    for i in range(n):
        ai = a[i] # 光の強さ_これにより照らせる範囲が決まる
        start = max(0, i - ai) #StartIndex_照らせる範囲
        end = min(n, i + ai + 1) #EndIndex + 1_照らせる範囲
        l[start] += 1 # 各々を'+1'と'-1'で表し...
        l[end] -= 1
    return np.cumsum(l)[:n] # 累積和をとる_cumulative sum

n, k = map(int, input().split())
a = list(map(int, input().split()))

for _ in range(k):
    a = imos(n, a)
    if a.min() == n: # すべての要素が最大値'n'になるとbreak
        break

print(*a)

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import njit

@njit
def solve():
    n, k = map(int,input().split())
    l = list(map(int,input().split()))
    
    if k >= 50:
        k = 50
    
    dp= [[0,0]]
    for i in range(n-1):
        dp += [[0]*2]
    
    ans = l[:]
    
    for i in range(k):
        for j in range(n):
            tmp = ans[j]
            dp[j][0] = (j+1 - tmp)
            dp[j][1] = (j+1 + tmp)
    
        ans = [0] * n
    
        for x in range(n):
            for y in range(n):
                if dp[y][0] <= x+1 <= dp[y][1]:
                    ans[x] += 1
    
    else:
        return ans

print(*solve())

Buggy submission (verdict: Runtime Error):
from numba import njit

@njit
def solve():
    n, k = map(int,input().split())
    l = list(map(int,input().split()))
    
    if k >= 50:
        k = 50
    
    dp= [[0,0]]
    for i in range(n-1):
        dp += [[0]*2]
    
    ans = l[:]
    
    for i in range(k):
        for j in range(n):
            tmp = ans[j]
            dp[j][0] = (j+1 - tmp)
            dp[j][1] = (j+1 + tmp)
    
        ans = [0] * n
    
        for x in range(n):
            for y in range(n):
                if dp[y][0] <= x+1 <= dp[y][1]:
                    ans[x] += 1
    
    else:
        return ans

print(*solve())

Buggy submission (verdict: Runtime Error):
from numba import njit

@njit
def solve():
    n, k = map(int,input().split())
    l = list(map(int,input().split()))
    
    if k >= 50:
        k = 50
    
    dp = [[0] * 2 for i in range(n)]
    
    ans = l[:]
    
    for i in range(k):
        for j in range(n):
            tmp = ans[j]
            dp[j][0] = (j+1 - tmp)
            dp[j][1] = (j+1 + tmp)
    
        ans = [0] * n
    
        for x in range(n):
            for y in range(n):
                if dp[y][0] <= x+1 <= dp[y][1]:
                    ans[x] += 1
    
    else:
        return ans

print(*solve())

Buggy submission (verdict: Runtime Error):
from numba import njit

@njit
def solve():
    n, k = map(int,input().split())
    l = list(map(int,input().split()))
    
    if k >= 50:
        k = 50
    
    dp = [[0] * 2 for i in range(n)]
    
    ans = l[:]
    
    for i in range(k):
        for j in range(n):
            tmp = ans[j] + 0.5
            dp[j][0] = (j+1 - tmp)
            dp[j][1] = (j+1 + tmp)
    
        ans = [0] * n
    
        for x in range(n):
            for y in range(n):
                if dp[y][0] <= x+1 <= dp[y][1]:
                    ans[x] += 1
    
    else:
        print(*ans)

solve()

Buggy submission (verdict: Runtime Error):
from numba import njit
@njit

def solve():
    n, k = map(int,input().split())
    l = list(map(int,input().split()))
    
    if k >= 50:
        k = 50
    
    dp = [[0] * 2 for i in range(n)]
    
    ans = l[:]
    
    for i in range(k):
        for j in range(n):
            tmp = ans[j] + 0.5
            dp[j][0] = (j+1 - tmp)
            dp[j][1] = (j+1 + tmp)
    
        ans = [0] * n
    
        for x in range(n):
            for y in range(n):
                if dp[y][0] <= x+1 <= dp[y][1]:
                    ans[x] += 1
    
    else:
        print(*ans)

solve()

Buggy submission (verdict: Runtime Error):
from numba import njit
@njit

n, k = map(int,input().split())
l = list(map(int,input().split()))

if k >= 50:
    k = 50

dp = [[0] * 2 for i in range(n)]

ans = l[:]

for i in range(k):
    for j in range(n):
        tmp = ans[j] + 0.5
        dp[j][0] = (j+1 - tmp)
        dp[j][1] = (j+1 + tmp)

    ans = [0] * n

    for x in range(n):
        for y in range(n):
            if dp[y][0] <= x+1 <= dp[y][1]:
                ans[x] += 1

else:
    print(*ans)

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

l = list(map(int,input().split()))

dp = [[0] * 2 for i in range(n)]

ans = l[:]

if k > 10**:
    k = 100
    
for i in range(k):
    for j in range(n):
        dp[j][0] = (j+1 - ans[j] - 0.5)
        dp[j][1] = (j+1 + ans[j] + 0.5)

    ans = [0] * n

    for x in range(n):
        for y in range(n):
            if dp[y][0] <= x+1 <= dp[y][1]:
                ans[x] += 1
else:
    print(*ans)

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

l = list(map(int,input().split()))

dp = [[0] * 2 for i in range(n)]

ans = l[:]

if k > 10**:
    k = 100
    
for i in range(k):
    for j in range(n):
        dp[j][0] = (j+1 - ans[j] - 0.5)
        dp[j][1] = (j+1 + ans[j] + 0.5)

    ans = [0] * n

    for x in range(n):
        for y in range(n):
            if dp[y][0] <= x+1 <= dp[y][1]:
                ans[x] += 1

else:
    print(*ans)