Problem:


Score : 400 points

Problem Statement

Joisino is planning to record N TV programs with recorders.

The TV can receive C channels numbered 1 through C.

The i-th program that she wants to record will be broadcast from time s_i to time t_i (including time s_i but not t_i) on Channel c_i.

Here, there will never be more than one program that are broadcast on the same channel at the same time.

When the recorder is recording a channel from time S to time T (including time S but not T), it cannot record other channels from time S-0.5 to time T (including time S-0.5 but not T).

Find the minimum number of recorders required to record the channels so that all the N programs are completely recorded.

Constraints

1≤N≤10^5

1≤C≤30

1≤s_i<t_i≤10^5

1≤c_i≤C

If c_i=c_j and i≠j, either t_i≤s_j or s_i≥t_j.

All input values are integers.

Input

Input is given from Standard Input in the following format:

N C
s_1 t_1 c_1
:
s_N t_N c_N

Output

When the minimum required number of recorders is x, print the value of x.

Sample Input 1

3 2
1 7 2
7 8 1
8 12 1

Sample Output 1

2

Two recorders can record all the programs, for example, as follows:

With the first recorder, record Channel 2 from time 1 to time 7. The first program will be recorded. Note that this recorder will be unable to record other channels from time 0.5 to time 7.

With the second recorder, record Channel 1 from time 7 to time 12. The second and third programs will be recorded. Note that this recorder will be unable to record other channels from time 6.5 to time 12.

Sample Input 2

3 4
1 3 2
3 4 4
1 4 3

Sample Output 2

3

There may be a channel where there is no program to record.

Sample Input 3

9 4
56 60 4
33 37 2
89 90 3
32 43 1
67 68 3
49 51 3
31 32 3
70 71 1
11 12 3

Sample Output 3

2



Sample input:
3 2
1 7 2
7 8 1
8 12 1


Sample output:
2

Submission status: Wrong Answer

Solution code:
n, c = map(int, input().split())
tv = [list(map(int, input().split())) for i in range(n)]

imos = [0 for i in range(10**5+2)]
for i in range(n):
    imos[tv[i][0]] += 1
    imos[tv[i][1]+1] -= 1

for i in range(10**5):
    imos[i+1] += imos[i]

print(max(imos))

Submission status: Wrong Answer

Solution code:
T_MAX = 10**5
n, nc = list(map(int, input().split()))
stc = [list(map(int, input().split())) for _ in range(n)]

rec = [0]*(T_MAX+1)
for s, t, c in stc:
    for i in range(s-1, t):
        rec[i] += 1

print(max(rec))

Submission status: Wrong Answer

Solution code:
T_MAX = 10**5
n, nc = list(map(int, input().split()))
stc = [list(map(int, input().split())) for _ in range(n)]

rec = [0]*(T_MAX+1)
for s, t, c in stc:
    rec[s-1] += 1
    rec[t] -= 1
for i in range(1, T_MAX+1):
    rec[i] += rec[i-1]

print(max(rec))

Submission status: Wrong Answer

Solution code:
T_MAX = 10**5
n, nc = list(map(int, input().split()))
stc = [list(map(int, input().split())) for _ in range(n)]

rec = [0]*(2*T_MAX+2)
for i in range(n):
    s, t, c = stc[i]
    rec[2*s-1] += 1
    rec[2*t+1] -= 1

for i in range(1, len(rec)):
    rec[i] += rec[i-1]
# print(rec[:100])

print(max(rec))

Submission status: Wrong Answer

Solution code:
T_MAX = 10**5
n, nc = list(map(int, input().split()))
stc = [list(map(int, input().split())) for _ in range(n)]

rec = [0]*(2*T_MAX+2)
for i in range(n):
    s, t, c = stc[i]
    rec[2*s-1] += 1
    rec[2*t] -= 1

for i in range(1, len(rec)):
    rec[i] += rec[i-1]
# print(rec[:100])

print(max(rec))

Submission status: Wrong Answer

Solution code:
T_MAX = 10**5
n, nc = list(map(int, input().split()))
stc = [list(map(int, input().split())) for _ in range(n)]

rec = [0]*(2*T_MAX+1)
for i in range(n):
    s, t, c = stc[i]
    rec[2*s-1] += 1
    rec[2*t] -= 1

for i in range(1, len(rec)):
    rec[i] += rec[i-1]
# print(rec[:100])

print(max(rec))

Submission status: Wrong Answer

Solution code:
from collections import deque
n, nc = list(map(int, input().split()))
stc = [list(map(int, input().split())) for _ in range(n)]
stc = sorted(stc)

schedule = [deque([]) for i in range(nc+1)]
t_end = 0
for i in range(n):
    s, t, c = stc[i]
    schedule[c].append((s, t))
    t_end = max(t_end, t)
# for i in range(1, nc+1): print(schedule[i])

rec = [(0, -1)]
for t in range(t_end+1):
    for r in range(len(rec)):
        t_remain, c = rec[r]
        rec[r] = (t_remain-1, c)
    
    for c in range(1, nc+1):
        if len(schedule[c]) == 0:
            continue
        st, en = schedule[c].popleft()
        if t < st:
            schedule[c].appendleft((st, en))
            continue
        else:
            for r in range(len(rec)):
                if rec[r][0] == 0 and rec[r][1] == c:
                    rec[r] = (en-st, c)
                    break
                elif rec[r][0] < 0:
                    rec[r] = (en-st, c)
                    break
                else:
                    rec.append((en-st, c))
                    break

    # print(rec, t)

print(len(rec))

Submission status: Wrong Answer

Solution code:
N, c = map(int, input().split())
time = [0 for i in range(100001)]
time_c = [[0 for i in range(100001)] for j in range(c)]
          
for i in range(N):
    S, T, C = map(int, input().split())
    time_c[C - 1][S - 1] += 1
    time_c[C - 1][T] -= 1
    
for i in range(100001):
    for j in range(c):
        time[i] += time_c[j][i]

for i in range(1, 100001):
    time[i] += time[i - 1]

print(max(time))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
time = [0 for i in range(100010)]
for i in range(N):
    S, T, C = map(int, input().split())
    time[S - 1] += 1
    time[T] -= 1
for i in range(1, 100010):
    time[i] += time[i - 1]
print(max(time))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
s = []
t = []
c = []
time = [0 for i in range(100001)]
for i in range(N):
    S, T, C = map(int, input().split())
    time[S - 1] += 1
    time[T] -= 1
for i in range(1, 100001):
    time[i] += time[i - 1]
print(max(time))

Submission status: Wrong Answer

Solution code:
n, c = map(int, input().split())
channel_list = list()
for i in range(n):
    input_list = list(map(int, input().split()))
    input_list[0] = input_list[0] - 0.5
    channel_list.append(input_list)
channel_list.sort(key=lambda x: x[1])
deck_num = 0
while channel_list:
    deck_num += 1
    prev_channel_end_time = channel_list[0][1]
    channel_list.pop(0)
    idx = 0
    while True:
        if not channel_list:
            break
        elif channel_list[idx][0] <= prev_channel_end_time:
            # 被ってるとき
            idx += 1
        else:
            # 被ってないとき
            prev_channel_end_time = channel_list[idx][1]
            channel_list.pop(idx)
        if idx > len(channel_list)-1:
            break

print(deck_num)

Submission status: Wrong Answer

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


# --------------------------------------------

dp = None


def main():
    N, C = li_input()

    A = [[0] * 100001 for _ in range(C)]
    S = [0] * 100001

    for i in range(N):
        s, t, c = li_input()

        for j in range(s, t):
            A[c - 1][j] += 1

    for a in A:
        for i in range(1, len(a)):
            if a[i]:
                S[i] += 1

    print(max(S))


main()

Submission status: Wrong Answer

Solution code:
import functools
N, C = map(int, input().split())
P = [[0 for j in range(10 ** 5 + 1)] for i in range(C)]
for i in range(N):
  s, t, c = map(int, input().split())
  for j in range(s - 1, t + 1):
    P[c - 1][j] = 1
ans = 0
for t in range(10 ** 5 + 1):
  ans = max(sum([P[c][t] for c in range(C)]), ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int,raw_input().split())

arr = [[0 for i in range((10**5+1))] for i in range(c)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	arr[ch-1][s-1] = 1
	arr[ch-1][t] = -1

for i in range(c):
	for j in range(1,(10**5+1)):
		arr[i][j] = arr[i][j-1] + arr[i][j]



ans = 0
for i in range(((10**5+1))):
	count = 0
	for j in range(c):
		if arr[j][i] > 0 :
			count += 1

	ans = max(ans,count)

print ans

Submission status: Wrong Answer

Solution code:
n,c = map(int,raw_input().split())

arr = [[0 for i in range((10**5+1))] for i in range(c)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	arr[ch-1][s] = 1
	arr[ch-1][t] = -1

for i in range(c):
	for j in range(1,(10**5+1)):
		arr[i][j] = arr[i][j-1] + arr[i][j]



ans = 0
for i in range(((10**5+1))):
	count = 0
	for j in range(c):
		if arr[j][i] > 0 :
			count += 1

	ans = max(ans,count)

print ans

Submission status: Wrong Answer

Solution code:
import operator
N, C = map(int, input().split())
stc = [[int(x) for x in input().split()] for _ in range(N)]

united = []
pc,ps,pt = 0,0,0
for x in sorted(stc, key=operator.itemgetter(2,0,1)):
    s, t, c = x
    if c == pc and s == pt:
        united[-1][2] = t
    else:
        united.append([s, t, c])
    ps, pt, pc = x
cnt = [0] * (10**5 + 1)
for x in united:
    s,t,c = x
    for i in range(s - 1, t):
        cnt[i] += 1
print(max(cnt))

Submission status: Wrong Answer

Solution code:
import operator
N, C = map(int, input().split())
stc = [[int(x) for x in input().split()] for _ in range(N)]

united = []
pc,ps,pt = 0,0,0
for x in sorted(stc, key=operator.itemgetter(2,0,1)):
    s, t, c = x
    if c == pc and t == pt:
        united[-1][2] = t
    else:
        united.append([s, t, c])
    ps, pt, pc = x
cnt = [0] * (10**5 + 1)
for x in united:
    s,t,c = x
    for i in range(s - 1, t):
        cnt[i] += 1
print(max(cnt))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, C, STC):
    tbl = [0] * (2*int(1e+5) + 2)
    for s, t, _ in STC:
        tbl[2*s-1] += 1
        tbl[2*t] -= 1
    for i in range(1, len(tbl)):
        tbl[i] += tbl[i-1]
    ans = max(tbl)
    return ans


def main():
    N, C = read_int_n()
    STC = [read_int_n() for _ in range(N)]
    print(slv(N, C, STC))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import functools
N, C = map(int, input().split())
T = [[0 for i in range(10 ** 5 + 1)] for j in range(C)]
for i in range(N):
  s, t, c = map(int, input().split())
  for j in range(s - 1, t + 1):
    T[c - 1][j] = 1
ans = 0
for i in range(10 ** 5 + 1):
  r = 0
  for j in range(C):
    r += T[j][i]
  ans = max(ans, r)
print(ans)

Submission status: Wrong Answer

Solution code:
import functools
N, C = map(int, input().split())
T = [0 for i in range(10 ** 5)]
for i in range(N):
  s, t, c = map(int, input().split())
  for j in range(s - 2, t):
    T[j] += 1
print(max(T))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
programs = [0] * (2 * (10**5 + 2))
for i in range(N):
    si, ti, ci = map(int, input().split())
    si = 2 * int(max(si - 0.5, 1))
    ti = 2 * ti
    for j in range(si, ti):
        programs[j] += 1
print(max(programs))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
programs = [0] * (2 * (10**5 + 2))
for i in range(N):
    si, ti, ci = map(int, input().split())
    si = 2 * (max(si - 1, 0))
    ti = 2 * ti
    for j in range(si, ti):
        programs[j] += 1
print(max(programs))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
programs = [0] * (2 * (10**5 + 1))
for i in range(N):
    si, ti, ci = map(int, input().split())
    si = si - 0.5
    for j in range(int(2*si), 2*ti-1):
        programs[j] += 1
print(max(programs))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
programs = [0] * (2 * (10**5 + 1))
for i in range(N):
    si, ti, ci = map(int, input().split())
    si = si - 0.5
    for j in range(int(2*si), 2*ti):
        programs[j] += 1
print(max(programs))

Submission status: Wrong Answer

Solution code:
import itertools
n, c = map(int, input().split())
lst = [0] * 100002
for _ in range(n):
  s, t, c = map(int, input().split())
  lst[s] += 1
  lst[t + 1] -= 1
acc = list(itertools.accumulate(lst))
print(max(acc))

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 2:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c = map(int,raw_input().split())

imos = [[0 for i in range(10**5+1)] for j in range(c)]
#10**5+1
imosa = [0 for i in range(10**5+1)]

for i in range(n):
	s,t,chan = map(int,raw_input().split())

	imos[chan-1][s-1] += 1
	imosa[s-1] += 1
	
	if imos[chan-1][s-1] >1:
		imosa[s-1] -= 1 
	
	imos[chan-1][t] -= 1
	imosa[t] -= 1

ims =  np.cumsum(imosa)
print max(ims)

Submission status: Wrong Answer

Solution code:
n, c = map(int, input().split())
T = 10**5+1
l = [[0]*c for _ in range(T)]

for _ in range(n):
    s, t, c_ = map(int, input().split())
    c_ -= 1
    l[s-1][c_] += 1
    l[t][c_]   -= 1

for i in range(1, T):
    for c_ in range(c):
        l[i][c_] += l[i-1][c_]

ans = 0
for i in range(T):
    ans = max(ans, sum(l[i]))

print(ans)

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())
stc=[]
for i in range(N):
    ss,tt,cc = map(int,input().split())
    stc.append((ss,tt,cc))
stc=sorted(stc,key=lambda x:x[0])
S=sorted(i[0] for i in stc)
T=sorted(i[1] for i in stc)
count=0
maxc=0
si,ti=0,0
while si<N:
    s=S[si]
    t=T[ti]
    if s<t:
        count+=1
        si+=1
    else:
        count-=1
        ti+=1
    if count>maxc:
        maxc=count
print(maxc)

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())
stc=[]
for i in range(N):
    ss,tt,cc = map(int,input().split())
    stc.append((ss-0.5,tt,cc))
stc=sorted(stc,key=lambda x:x[0])
S=sorted(i[0] for i in stc)
T=sorted(i[1] for i in stc)
count=0
maxc=0
si,ti=0,0
while si<N:
    s=S[si]
    t=T[ti]
    if s<t:
        count+=1
        si+=1
    else:
        count-=1
        ti+=1
    if count>maxc:
        maxc=count
print(maxc)

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())
stc=[]
for i in range(N):
    ss,tt,cc = map(int,input().split())
    stc.append((ss-0.5,tt,cc))
stc=sorted(stc,key=lambda x:x[0])
S=sorted(i[0] for i in stc)
T=sorted(i[1] for i in stc)
nw=S[0]
count=1
maxc=1
si,ti=1,0
while si<N:
    s=S[si]
    t=T[ti]
    if s<=t:
        count+=1
        si+=1
    else:
        count-=1
        ti+=1
    if count>maxc:
        maxc=count
print(maxc)

Submission status: Wrong Answer

Solution code:
N, Ch = map(int, input().split())
L = [list(map(int, input().split())) for i in range(N)]
L.sort(key=lambda x: x[0])
time = 0
T = [-1]
C = [-1]
ans = 1
for si, ti, ci in L:
    if time < si:
        time = si
        for xt, t in enumerate(T):
            if t == -1:
                continue
            elif t < si:
                T[xt] = -1
                C[xt] = -1
            elif t == si:
                T[xt] = -2
                
    if -2 in T:
        index = T.index(-2)
        if C[index] == ci:
            T[index] = ti
            continue
    if -1 in T:
        index = T.index(-1)
        T[index] = ti
        C[index] = ci
        continue
    else:
        ans += 1
        T.append(ti)
        C.append(ci)
print(ans)

Submission status: Wrong Answer

Solution code:
N, Ch = map(int, input().split())
L = [list(map(int, input().split())) for i in range(N)]
L.sort(key=lambda x: x[0])
t = 0
T = [-1]
C = [-1]
ans = 1
for si, ti, ci in L:
    for xt, t in enumerate(T):
        if t == -1 or t == -2:
            continue
        elif t < si:
            T[xt] = -1
            C[xt] = -1
        elif t == si:
            T[xt] = -2
    if -2 in T:
        index = T.index(-2)
        if C[index] == ci:
            T[index] = ti
            continue
    if -1 in T:
        index = T.index(-1)
        T[index] = ti
        C[index] = ci
        continue
    else:
        ans += 1
        T.append(ti)
        C.append(ci)
print(ans)

Submission status: Wrong Answer

Solution code:
N, Ch = map(int, input().split())
L = [list(map(int, input().split())) for i in range(N)]
L.sort(key=lambda x:x[0])
t = 0
T = [-1]
C = [-1]
ans = 1
for si, ti, ci in L:
    for xt, t in enumerate(T):
        if t == -1:
            continue
        elif t < si:
            T[xt] = -1
            C[xt] = -1
        elif t == si:
            T[xt] = -2
    if -2 in T:
        index = T.index(-2)
        if C[index] == ci:
            T[index] = ti
            continue
    if -1 in T:
        index = T.index(-1)
        T[index] = ti
        C[index] = ci
        continue
    else:
        ans += 1
        T.append(ti)
        C.append(ci)
print(ans)

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for x in range(N)]
times = [0]*(pow(10,5)+2)
channels = []
tvs.sort(key=lambda x:(x[2],x[0]))
count = 0
while count < N-1:
  if (tvs[count][2] == tvs[count+1][2]) and (tvs[count][1] == tvs[count+1][0]):
    channels.append([tvs[count][0],tvs[count+1][1],tvs[count][2]])
    count += 1
  else:
    channels.append(tvs[count])
  count += 1
if tvs[-1] not in channels:
  channels.append(tvs[-1])
for chan in channels:
  times[chan[0]] += 1
  times[chan[1]+1] -=1
for i in range(1,len(times)):
  times[i] += times[i-1]
print(max(times))

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for x in range(N)]
times = [0]*(pow(10,5)+2)
channels = []
tvs.sort(key=lambda x:(x[2],x[0]))
count = 0
while count < N-1:
  if (tvs[count][2] == tvs[count+1][2]) and (tvs[count][1]+1 == tvs[count+1][0]):
    channels.append([tvs[count][0],tvs[count+1][1],tvs[count][2]])
    count += 1
  else:
    channels.append(tvs[count])
  count += 1
if tvs[-1] not in channels:
  channels.append(tvs[-1])
for chan in channels:
  times[chan[0]] += 1
  times[chan[1]+1] -=1
for i in range(1,len(times)):
  times[i] += times[i-1]
print(max(times))

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for x in range(N)]
times = [0]*(pow(10,5)+2)
channels = []
tvs.sort(key=lambda x:(x[2],x[0]))
count = 0
while count < N-1:
  if (tvs[count][2] == tvs[count+1][2]) and (tvs[count][1]+1 == tvs[count+1][0]):
    channels.append([tvs[count][0],tvs[count+1][1],tvs[count][2]])
    count += 1
  else:
    channels.append(tvs[count])
  count += 1
for chan in channels:
  times[chan[0]] += 1
  times[chan[1]+1] -=1
for i in range(1,len(times)):
  times[i] += times[i-1]
print(max(times))

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for x in range(N)]
times = [0]*(pow(10,5)+2)
for tv in tvs:
  times[tv[0]] += 1
  times[tv[1]+1] -=1
for i in range(1,len(times)):
  times[i] += times[i-1]
print(max(times))

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for x in range(N)]
times = [0]*(pow(10,5)+2)
for tv in tvs:
  times[tv[0]] += 1
  times[tv[1]+1] -=1
for i in range(1,len(times)-1):
  times[i] += times[i-1]
print(max(times))

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import Counter
N,C = map(int,input().split())
link =[[] for _ in range(C+1)]
for i in range(N):
    x,y,c=[int(i) for i in input().split()]
    link[c].append((x,y))
siyou = np.array([0] * (C) * 100000).reshape(C,100000)
for i in range(1,C+1):
  for x,y in link[i]:
    siyou[i-1][x:y] = 1
print(np.max((np.sum(siyou, axis=0))))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
program_list = [0 for _ in range((((10 ** 5) * 2) + 10))]

for _ in range(N):
    s, t, c = map(int, input().split())
    program_list[(s * 2) - 1] += 1
    program_list[(t * 2)] -= 1

for i in range(1, len(program_list)):
    program_list[i] += program_list[i - 1]
print(max(program_list))

Submission status: Wrong Answer

Solution code:
l = [0]*(2*10**5+10)

n, c = map(int, input().split())
for _ in range(n):
    s, t, c = map(int, input().split())
    l[s*2-1] += 1
    l[t*2]   -= 1
for i in range(1, len(l)):
    l[i] += l[i-1]
print(max(l))

Submission status: Wrong Answer

Solution code:
n,c = map(int, input().split())

a = []
for i in range(n):
    a.append([x for x in map(int, input().split())])


result = [0] * 200005

for _s in a:
    result[_s[0]*2-1]+=1
    result[_s[1]*2] += -1

for i in range(1, len(result)-1, 1):
    result[i] = result[i] + result[i-1]

ans = max(result)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int, input().split())

a = []
for i in range(n):
    a.append([x for x in map(int, input().split())])


result = [0] * 200005

for _s in a:
    result[_s[0]*2-1]+=1
    result[_s[1]*2] += -1

for i in range(1, len(result), 1):
    result[i] = result[i] + result[i-1]

ans = max(result)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int, input().split())

a = []
for i in range(n):
    a.append([x for x in map(int, input().split())])


result = [0] * 200005

for _s in a:
    result[_s[0]*2-1]+=1
    result[_s[1]*2] += -1

for i in range(len(result)-1):
    result[i] = result[i] + result[i-1]

ans = max(result)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int, input().split())

a = []
for i in range(n):
    a.append([x for x in map(int, input().split())])


result = [0] * 200005

for _s in a:
    result[_s[0]*2-1]+=1
    result[_s[1]*2] += -1

for i in range(len(result)-1):
    result[i+1] = result[i+1] + result[i]

ans = max(result)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int, input().split())

a = []
for i in range(n):
    a.append([x for x in map(int, input().split())])


result = [0] * 200005

for _s in a:
    result[_s[0]*2-1]+=1
    result[_s[1]*2] += -1

for i in range(len(result)):
    result[i] = result[i] + result[i-1]

ans = max(result)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int, input().split())

a = []
for i in range(n):
    a.append([x for x in map(int, input().split())])

b = []

s = [x[0] for x in a]
t = [x[1] for x in a]
c = [x[2] for x in a]

t_max = max(t)
t_min = min(t)

all_s = []

for _s, _t in zip(s, t):
    tmp = []
    tmp = [0] * (t_max+1)
    for i in range(_s, _t+1, 1):
        tmp[i] = 1
    all_s.append(list(tmp))

print(all_s)
result = [0] * len(all_s[0])
for _s in all_s:
    for i in range(len(all_s[0])):
       if _s[i] == 1:
           result[i] +=1

ans = max(result)

print(ans)

Submission status: Wrong Answer

Solution code:
n,c=[int(i) for i in input().split()]
s=[]
t=[]
for _ in range(n):
  a=[int(i) for i in input().split()]
  s.append(a[0]-0.5)
  t.append(a[1])

s.sort()
t.sort()
x=0
m=0
si=0
ti=0
while si != len(s):
  if s[si] < t[ti]:
    x+=1
    si+=1
  else:
    x-=1
    ti+=1
  m = max(m,x)
print(m)

Submission status: Wrong Answer

Solution code:
n, c = map(int, input().split())
tv = []
for _ in range(n):
    s, t, ci = map(int, input().split())
    tv.append([s, t, ci])
    
tv.sort()
cnt = 1
end_time = [tv[0][1]]

for i in range(1, n):
    if tv[i][0] - 0.5 < end_time[0]:
        cnt += 1
    else :
        end_time.pop(0)
        
    end_time.append(tv[i][1])
            
print(cnt)

Submission status: Wrong Answer

Solution code:
#abc080d

n,c=map(int,raw_input().split())
l=[0 for i in xrange(10**5+2)]
for i in xrange(n):
 s,t,c=map(int,raw_input().split())
 l[s-1]+=1
 l[t]-=1
for i in xrange(1,10**5+2):
 l[i]+=l[i-1]
print max(l)

Submission status: Wrong Answer

Solution code:
#abc080d

n,c=map(int,raw_input().split())
l=[0 for i in xrange(10**5+1)]
for i in xrange(n):
 s,t,c=map(int,raw_input().split())
 l[s-1]+=1
 l[t]-=1
for i in xrange(1,10**5+1):
 l[i]+=l[i-1]
print max(l)

Submission status: Wrong Answer

Solution code:
n, c = map(int, input().split())
imos = [0] * 100002

for i in range(n):
    s, t, c = map(int, input().split())
    imos[s - 1] += 1
    imos[t] -= 1

for i in range(100001):
    imos[i + 1] += imos[i]

print(max(imos))

Submission status: Wrong Answer

Solution code:
n,c=list(map(int,input().split()))
s=[0 for i in range(n)]
t=[0 for i in range(n)]
c=[0 for i in range(n)]

for i in range(n):
  s[i],t[i],c[i]=list(map(int,input().split()))
  s[i]=s[i]-0.5

u=s+t
u.sort()

cnt=[0 for i in range(len(u)+1)]

for i in range(1,len(u)+1):
  cnt[i]=cnt[i-1]
  if isinstance(u[i-1],float):
    cnt[i]+=1
  else:
    cnt[i]-=1

print(max(cnt))

Submission status: Wrong Answer

Solution code:
n,c=list(map(int,input().split()))
s=[0 for i in range(n)]
t=[0 for i in range(n)]
c=[0 for i in range(n)]

for i in range(n):
  s[i],t[i],c[i]=list(map(int,input().split()))
  s[i]=s[i]-0.5

u=s+t
u.sort()

cnt=[0 for i in range(len(u)+1)]

for i in range(1,len(u)+1):
  cnt[i]=cnt[i-1]
  if type(u[i-1])=="float":
    cnt[i]+=1
  else:
    cnt[i]-=1

print(max(cnt))

Submission status: Wrong Answer

Solution code:
n,c=list(map(int,input().split()))
s=[0 for i in range(n)]
t=[0 for i in range(n)]
c=[0 for i in range(n)]

cnt=[0 for i in range(2*10**5)]

for i in range(n):
  s[i],t[i],c[i]=list(map(int,input().split()))

for i in range(1,2*10**5):
  cnt[i]=cnt[i-1]
  if i in s:
    cnt[i]+=1
  if i in t:
    cnt[i]-=1

print(max(cnt))

Submission status: Wrong Answer

Solution code:
#import sys

N, C = map(int, input().split(' '))

sche = [[0]*C  for i in range(100000)]

for i in range(N):
    s, t, c = map(int, input().split(' '))
    for j in range(s-1, t):
        sche[j][c-1] = 1

ans = 0
for i in range(1000000):
    b = sum(sche[j])
    ans = max(ans,b)
print(ans)

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())
chan = ''
max1 = 0
for x in range(C):
    chan = chan + '0'
reserv = {}
for i in range(N):
    tmp = input().split()
    s,t,c=int(tmp[0]),int(tmp[1]),int(tmp[2])
    for j in range(s,t+1):
        if j in reserv:
            work = list(reserv[j])
            max1 = max(max1,1 + reserv[j].count('1'))
        else:
            max1 = max(max1,1)
            work = list(chan)
        work[(c-1)] = '1'
        reserv[j] = "".join(work)
print(max1)

Submission status: Wrong Answer

Solution code:
N, C = list(map(int, input().split()))
tmax = 0
s = [0 for _ in range(N)]
t = [0 for _ in range(N)]
c = [0 for _ in range(N)]
for i in range(N):
    s[i], t[i], c[i] = list(map(int, input().split()))
    if t[i] >= tmax:
        tmax = t[i]

c_timeline = [[0 for _ in range(C)] for _ in range(2*tmax + 1)]
for c in c:
    S = s[i]
    T = t[i]
    for j in range(2*S-1, 2*T+1):
        c_timeline[j][c-1] = 1

rokuga = 0
for timeline in c_timeline:
    time = sum(timeline)
    if rokuga < time:
        rokuga = time

print(rokuga)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

u"""

dict:
  key channel
  value duration, [start, end], merged

videoL : [[ (duration), ...) ] ... ] len(videoL) == # of video recorders

loop while programs
  find the smallest enty
  remove the entry
  add to videoL

"""

n, c = [int(e) for e in raw_input().split()]

pgmL = {}
for i in xrange(0, n):
    s, t, c = [int(e) for e in raw_input().split()]
    pgmL.setdefault(c, []).append([s, t])

# print n, c
# print pgmL

mL = []
for k in pgmL:
    tl = pgmL[k]
    tl.sort()
    
    ntl = [tl[0]]
    # print ntl
    i = 0
    si = tl[0][0]
    ti = tl[0][1]
    for j in xrange(1, len(tl)):
        sj = tl[j][0]
        tj = tl[j][1]
        if ti == sj:
            ntl[i] = [si, tj]
        else:
            ntl.append([sj, tj])
            si = sj
            ti = tj
            i += 1
    mL.extend(ntl)

mL.sort()
# print mL

u"""
終了時間が早いVCRに入れてゆく
"""

vl = []
for p in mL:
    ps = p[0]
    pt = p[1]
    minI = -1
    minT = sys.maxint
    for i in xrange(0, len(vl)):
        vt = vl[i]
        if vt < ps:
            if vt < minT:
                minT = vt
                minI = i
    if minT == sys.maxint:
        vl.append(pt)
    else:
        vl[minI] = pt

# print vl

sys.stdout.write('%d\n' % len(vl))
sys.stdout.flush()

Submission status: Wrong Answer

Solution code:
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(200001) 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)))

Submission status: Wrong Answer

Solution code:
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(200001) for i in range(C)])

# チャンネルごとにソート
STC.sort(key=lambda x: x[2])

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc080/tasks/abc080_d

"""
import sys
from sys import stdin
from heapq import heappop, heappush, heappushpop
input = stdin.readline


def solve(programs, N, C):
    max_used = 1
    R = []
    programs.sort()

    heappush(R, 0)
    for s, t, c in programs:
        end_time = heappushpop(R, t)
        if end_time >= s:
            heappush(R, end_time)
            max_used = len(R)
    return max_used


def main(args):
    programs = []
    N, C = map(int, input().split())
    for _ in range(N):
        s, t, c = map(int, input().split())
        programs.append([s, t, c])
    ans = solve(programs, N, C)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])