Problem p03504 (python)

Fixed submission:
import numpy as np

n,c = map(int,input().split())
table = np.zeros(10**5+2, dtype=np.int32)
chs = [[] for _ in range(c+1)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chs[c].append([s,t])

# 同チャンネル内の連続番組を合体
times = []
for ch in chs:
    if not ch: continue
    ch.sort()
    for i in range(len(ch)):
        if i == 0: continue
        if ch[i-1][1] == ch[i][0]:
            ch[i] = [ch[i-1][0], ch[i][1]]
            ch[i-1] = []
    for arr in ch:
        if not arr: continue
        times.append(arr)

# いもす法
for arr in times:
    table[arr[0]] += 1
    table[arr[1]+1] -= 1

# 累積和の最大値
ans = table.cumsum().max()

print(ans)

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

n,c = map(int,input().split())

table = np.zeros(10**5+1, dtype=np.int)
ch = [[] for _ in range(c+1)]

for _ in range(n):
    s,t,c = map(int,input().split())
    ch[c].append([s,t])

times = []
for arr in ch:
    if not arr: continue
    for i in range(len(arr)):
        if i == 0: continue
        if arr[i-1][1] == arr[i][0]:
            arr[i] = [arr[i-1][0], arr[i][1]]
            arr[i-1] = []
    for ele in arr:
        if not ele: continue
        times.append(ele)

# いもす法
for ele in times:
    table[ele[0]] += 1
    table[ele[1]+1] -= 1

# 累積和の最大値
ans = table.cumsum().max()

print(ans)

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

n,c = map(int,input().split())

table = np.zeros(10**5+1, dtype=np.int)
chan = [[] for _ in range(c+2)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chan[c].append([s,t])

# 同チャンネルの連続番組を統合する
times = []
for i in range(c+2):
    arr = chan[i]
    if chan[i]==[] : continue
    for i in range(len(arr)):
        if i == len(arr)-1 : break
        if arr[i][1] == arr[i+1][0]:
            arr[i+1] = [arr[i][0], arr[i+1][1]]
            arr[i] = [1,0]
    times += arr

# いもす法
for s,t in times:
    table[s] += 1
    table[t+1] -= 1

# 累積和の計算
ans = table.cumsum().max()

print(ans)

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

n,c = map(int,input().split())

table = np.zeros(10**5+1)
chan = [[] for _ in range(c+2)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chan[c].append([s,t])

# 同チャンネルの連続番組を統合する
times = []
for i in range(c+2):
    arr = chan[i]
    if chan[i]==[] : continue
    for i in range(len(arr)):
        if i == len(arr)-1 : break
        if arr[i][1] == arr[i+1][0]:
            arr[i+1] = [arr[i][0], arr[i+1][1]]
            arr[i] = [1,0]
    times += arr

# いもす法
for s,t in times:
    table[s] += 1
    table[t+1] -= 1

# 累積和の計算
ans = int(table.cumsum().max())

print(ans)

Buggy submission (verdict: Runtime Error):
n,c = map(int,input().split())
table = [0 for i in range(10**5+1)]
chan = [[] for _ in range(c+2)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chan[c].append([s,t])

# 同チャンネルの連続番組を統合する
times = []
for i in range(c+2):
    arr = chan[i]
    if chan[i]==[] : continue
    for i in range(len(arr)):
        if i == len(arr)-1 : break
        if arr[i][1] == arr[i+1][0]:
            arr[i+1] = [arr[i][0], arr[i+1][1]]
            arr[i] = [1,0]
    times += arr

# いもす法
for ele in times:
    table[ele[0]] += 1
    table[ele[1]+1] -= 1

# 累積和の計算
ans = 0
for i in range(len(table)):
    if i==0 : continue
    table[i] += table[i-1]
    ans = max(ans, table[i])

print(ans)

Buggy submission (verdict: Runtime Error):
n,c = map(int,input().split())
table = [0 for i in range(10**5+1)]
chan = [[] for _ in range(c+2)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chan[c].append([s,t])

# 同チャンネルの連続番組を統合する
times = []
for i in range(c+2):
    arr = chan[i]
    if chan[i]==[] : continue
    for i in range(len(arr)):
        if i == len(arr)-1 : break
        if arr[i][1] == arr[i+1][0]:
            arr[i+1] = [arr[i][0], arr[i+1][1]]
            arr[i] = [1,0]
    times += arr

# いもす法
for ele in times:
    table[ele[0]] += 1
    table[ele[1]+1] -= 1

# 累積和の計算
for i in range(len(table)):
    if i==1 : continue
    table[i] += table[i-1]

print(max(table))

Buggy submission (verdict: Runtime Error):
n,c = map(int,input().split())
table = [0]*(10**5)
chan = [[] for _ in range(c+1)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chan[c].append([s,t])

# 同チャンネルの連続番組を統合する
times = []
for i in range(c+2):
    arr = chan[i]
    if chan[i]==[] : continue
    for i in range(len(arr)):
        if i == len(arr)-1 : break
        if arr[i][1] == arr[i+1][0]:
            arr[i+1] = [arr[i][0], arr[i+1][1]]
            arr[i] = [1,0]
    times += arr

# いもす法
for ele in times:
    table[ele[0]] += 1
    table[ele[1]+1] -= 1

# 累積和の計算
for i in range(len(table)):
    if i==1 : continue
    table[i] += table[i-1]

print(max(table))

Buggy submission (verdict: Runtime Error):
n,c = map(int,input().split())
table = [0]*(10**5)
chan = [[] for _ in range(c+1)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chan[c].append([s,t])

times = []
for i in range(c+2):
    arr = chan[i]
    if chan[i]==[] : continue
    for i in range(len(arr)):
        if i == len(arr)-1 : break
        if arr[i][1] == arr[i+1][0]:
            arr[i+1] = [arr[i][0], arr[i+1][1]]
            arr[i] = [1,0]
    times += arr

for ele in times:
    table[ele[0]] += 1
    table[ele[1]+1] -= 1

for i in range(len(table)):
    if i==1 : continue
    table[i] += table[i-1]



print(times)
print(max(table))