Problem p03504 (python)

Fixed submission:
import numpy

N, C = map(int, input().split())
STC = [list(map(int, input().split())) for i in range(N)]
Channel = numpy.array([[0]*(2*10**5+1) for i in range(C+1)])

for s, t, c in STC:
    Channel[c][2*s-1] += 1
    Channel[c][2*t] -= 1
    
for i in range(len(Channel)):
    Channel[i] = numpy.cumsum(Channel[i])
bool_Channel = Channel.astype(numpy.bool_)

needs = numpy.sum(bool_Channel, axis=0)
print(needs.max())

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N, C = map(int, input().split())
TimeTable = [[0] * (10 ** 5 + 1) for i in range(C + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    TimeTable[c][s] += 1
    TimeTable[c][t + 1] -= 1

for c in range(C + 1):
    TimeTable[c] = list(accumulate(TimeTable[c]))


ans = 0
for i in range(10 ** 5 + 1):
    cnt = 0
    for c in range(C + 1):
        cnt += min(TimeTable[c][i], 1)
    ans = max(ans, cnt)

print(ans)

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

N, C = map(int, input().split())
STC = [tuple(map(int, input().split())) for i in range(N)]

# 0.5秒から10万秒まで0.5秒区切り
time = np.array([np.zeros(30) for i in range(C)])

# STC処理
for s, t, c in STC:
    # c-1でチャンネル番号ごとのtimeにアクセス
    if time[c-1][2*s] != 0:
        time[c-1][2*s] = 0
    else:
        time[c-1][2*s-2] += 1
    time[c-1][2*t] -= 1

# 各チャンネルごとに累積和を取る
for i in range(C):
    time[i-1] = np.cumsum(time[i-1])
    
# チャンネルの被りをあぶりだし
A = np.sum(time, axis=0)
print(int(np.max(A)))

Buggy submission (verdict: Runtime Error):
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku =  [[] for i in range(20003)]

for s,t,c in timeTable:
    if s == 0:
        for i in range(2*t):
            sutyoku[i].append(c)
    else:
        for i in range(2*s-1,2*t):
            sutyoku[i].append(c)

su_len = []
for s in sutyoku:
    su_len.append(len(set(s)))

print(max(su_len))

Buggy submission (verdict: Runtime Error):
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku =  [{0} for i in range(20003)]

for s,t,c in timeTable:
    if s == 0:
        for i in range(2*t):
            sutyoku[i].add(c)
    else:
        for i in range(2*s-1,2*t):
            sutyoku[i].add(c)

ans = 0
for s in sutyoku:
    ans = max(ans, len(s)-1)

print(ans)

Buggy submission (verdict: Runtime Error):
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku =  [set() for i in range(20002)]

for s,t,c in timeTable:
    if s == 0:
        for i in range(2*t):
            sutyoku[i].add(c)
    else:
        for i in range(2*s-1,2*t):
            sutyoku[i].add(c)

ans = 0
for s in sutyoku:
    ans = max(ans, len(s))

print(ans)

Buggy submission (verdict: Runtime Error):
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku =  [set() for i in range(20003)]

for s,t,c in timeTable:
    if s == 0:
        for i in range(2*t):
            sutyoku[i].add(c)
    else:
        for i in range(2*s-1,2*t):
            sutyoku[i].add(c)

ans = 0
for s in sutyoku:
    ans = max(ans, len(s))

print(ans)