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:
import itertools
N,C = map(int,input().split())
imos = [0]*(10**6)
info = [list(map(int,input().split())) for i in range(N)]
info = sorted(info,key=lambda x:(x[2],x[0]))
note = -1
before_t = -1
for i in range(N):
    s,t,c = info[i]
    s -= 1; t -= 1
    if c == note and s < before_t:
        s = before_t
    imos[s] += 1
    imos[t+1] -= 1
    note = c
    before_t = t
acc_sum = list(itertools.accumulate(imos))
ans = max(acc_sum)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
N,C = map(int,input().split())
imos = [0]*(10**6)
info = [list(map(int,input().split())) for i in range(N)]
info = sorted(info,key=lambda x:x[2])
note = -1
before_t = -1
for i in range(N):
    s,t,c = info[i]
    s -= 1
    if c == note and s < before_t:
        s = before_t
    imos[s] += 1
    imos[t+1] -= 1
    note = c
    before_t = t
acc_sum = list(itertools.accumulate(imos))
ans = max(acc_sum)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
N,C = map(int,input().split())
imos = [0]*(10**5 + 2)
info = [list(map(int,input().split())) for i in range(N)]
info = sorted(info,key=lambda x:x[2])
for i in range(N):
    s,t,c = info[i]
    if i == 0:
        s -= 1
    imos[s] += 1
    imos[t+1] -= 1
    info.append([s,t,c])
acc_sum = list(itertools.accumulate(imos))
ans = max(acc_sum)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
N,C = map(int,input().split())
imos = [0]*(10**5 + 1)
info = []
for i in range(N):
    s,t,c = map(int,input().split())
    imos[s-1] += 1
    imos[t] -= 1
    info.append([s,t,c])
acc_sum = list(itertools.accumulate(imos))
ans = max(acc_sum)
print(ans)

Submission status: Wrong Answer

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

stc.sort()
counter = 0
array = []

for i in stc:
    s, t, c =  i
    flag = True
    for j in range(len(array)):
        if array[j][0] < s:
            array[j] = [t, s, c]
            flag = False
            array.sort(reverse = True)
            break

    if flag:
        array.append([t, s, c])
        array.sort(reverse = True)
        counter += 1

print(counter)

Submission status: Wrong Answer

Solution code:
N, C = list(map(int, input().split()))
prog = []

for _ in range(N):
    prog.append((list)(map(int, input().split())))

T = 10**5
for i in range(T):
    a = 0
for i in range(T):
    a = 1
for i in range(T):
    a = 2
for i in range(T):
    a = 6
print(a)

Submission status: Wrong Answer

Solution code:
N, C = list(map(int, input().split()))
prog = []

for _ in range(N):
    prog.append((list)(map(int, input().split())))

T = 10**5
for i in range(T):
    a = 0
print(a)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
import heapq
# from collections import defaultdict, deque

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


N, C = LI()
tv = []
for _ in range(N):
    s, t, c = LI()
    s -= 0.5
    tv.append((t, s, c))

tv.sort()

ans = 1
used = [(0, tv[0][2])]
for i in range(N):
    t, s, c = tv[i]
    for _ in range(ans):
        prev_t, channel = heapq.heappop(used)
        if c == channel:
            prev_t -= 0.5

        if prev_t <= s:
            heapq.heappush(used, (t, c))
            break

        heapq.heappush(used, (prev_t, channel))
    else:
        heapq.heappush(used, (t, c))
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
import heapq

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


N, C = LI()
tv = []
for _ in range(N):
    s, t, c = LI()
    s -= 0.5
    tv.append((t, s, c))

tv.sort()

ans = 1
used = [[0, tv[0][2]]]
for i in range(N):
    t, s, c = tv[i]
    for j in range(ans):
        prev_t, channel = used[j]
        if c == channel:
            prev_t -= 0.5

        if prev_t <= s:
            used[j] = [t, c]
            break
    else:
        used.append([t, c])
        ans += 1

    used.sort()

print(ans)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
import heapq
# from collections import defaultdict, deque

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


N, C = LI()
tv = []
for _ in range(N):
    s, t, c = LI()
    s -= 0.5
    tv.append((t, s, c))

tv.sort()

ans = 1
used = [[0, tv[0][2]]]
for i in range(N):
    t, s, c = tv[i]
    for j in range(ans):
        prev_t, channel = used[j]
        if c == channel:
            prev_t -= 0.5

        if prev_t <= s:
            used[j] = [t, c]
            break
    else:
        used.append([t, c])
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
def inpl(): return list(map(int, input().split()))

N, C = inpl()
stc = [inpl() for _ in range(N)]
stc.sort()

num = [(-1, -1)]
for s, t, c in stc:
    for i, Tuple in enumerate(num):
        # print(s, t)
        ch = Tuple[0]
        ti = Tuple[1]
        if s - 0.5 >= ti:
            num[i] = (c, t)
            break
    else:
        num.append((c, t))
print(len(num))

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
STC = [tuple(map(int,input().split())) for _ in range(N)]

lenA = 200001
A = [0]*lenA
for i in range(N):
    a = 1

for (s,t,c) in STC:
    A[s*2-1] += 1
    A[t*2] -= 1

for i in range(lenA-1):
    A[i+1] += A[i]

print(max(A))

Submission status: Wrong Answer

Solution code:

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

prog = [[] for i in range(C)]

for i in range(N):
    s,t,c = list(map(int,input().split()))
    prog[c-1].append([s,t])

ttable = [0 for i in range(2*(10**5)+2)]
for i in range(C):
    table = [0 for i in range(2*(10**5)+2)]
    for p in prog[i]:
        table[2*p[0]-1] += 1
        table[2*p[1]] -= 1
    for i in range(1,2*(10**5)+2):
        table[i]+=table[i-1]
    for i in range(2*(10**5)+2):
        ttable[i]+=table[i]
print(max(ttable))

Submission status: Wrong Answer

Solution code:
N,C = list(map(int,input().split()))

prog = [[] for i in range(C)]

for i in range(N):
    s,t,c = list(map(int,input().split()))
    prog[c-1].append([s,t])

ttable = [0 for i in range(2*(10**5)+2)]
for i in range(C):
    table = [0 for i in range(2*(10**5)+2)]
    for p in prog[i]:
        table[2*p[0]-1] += 1
        table[2*p[1]] -= 1
    tsum = 0
    for i in range(2*(10**5)+2):
        tsum+=table[i]
        ttable[i]+=tsum
print(max(ttable))

Submission status: Wrong Answer

Solution code:
N,C = list(map(int,input().split()))

prog = [[] for i in range(C)]

for i in range(N):
    s,t,c = list(map(int,input().split()))
    prog[c-1].append([s,t])

ttable = [0 for i in range(2*(10**5)+2)]
for i in range(C):
    table = [0 for i in range(2*(10**5)+2)]
    for p in prog[i]:
        table[2*p[0]-1]= 1
        table[2*p[1]]= -1
    tsum = 0
    for i in range(2*(10**5)+2):
        tsum+=table[i]
        ttable[i]+=tsum
print(max(ttable))

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())

L=[[0 for i in range(2*10**5+2)]for j in range(30)]
for i in range(N):
    s,t,c=map(int,input().split())
    L[c-1][2*s-1]+=1
    L[c-1][2*t+1]-=1
    
ans=0    
S=0
for j in range(2*10**5+2):
    for i in range(30):
        S+=L[i][j]
    if ans<S:
        ans=S
print(ans)

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())

L=[[0 for i in range(2*10**5+1)]for j in range(30)]
for i in range(N):
    s,t,c=map(int,input().split())
    L[c-1][2*s-1]+=1
    L[c-1][2*t]-=1
    
ans=0    
S=0
for j in range(2*10**5+1):
    for i in range(30):
        S+=L[i][j]
    if ans<S:
        ans=S
print(ans)

Submission status: Wrong Answer

Solution code:
N, C = [int(_) for _ in input().split()]
STC = [[int(_) for _ in input().split()] for _ in range(N)]
ST = [[set(), set()] for _ in range(C)]
for s, t, c in STC:
    c -= 1  #0-indexed
    ST[c][0].discard(t)
    ST[c][1].discard(s)
    ST[c][0].add(s)
    ST[c][1].add(t)
D = {}
for S, T in ST:
    for s in S:
        D[s - 0.5] = D.get(s - 0.5, 0) + 1
    for t in T:
        D[t] = D.get(t, 0) - 1
times = sorted(D.keys())
count = 0
ans = 0
for time in times:
    count += D[time]
    ans = max(ans, count)
print(ans)

Submission status: Wrong Answer

Solution code:
N, C = [int(_) for _ in input().split()]
STC = [[2 * int(_) for _ in input().split()] for _ in range(N)]
D = {}
for s, t, c in STC:
    D[s - 0.5] = D.get(s - 0.5, 0) + 1
    D[t + 0.5] = D.get(t + 0.5, 0) - 1
times = sorted(D.keys())
count = 0
ans = 0
for time in times:
    count += D[time]
    ans = max(ans, count)
print(ans)

Submission status: Wrong Answer

Solution code:
N, C = [int(_) for _ in input().split()]
STC = [[int(_) for _ in input().split()] for _ in range(N)]
D = {}
for s, t, c in STC:
    D[s - 0.5] = D.get(s - 0.5, 0) + 1
    D[t] = D.get(t, 0) - 1
times = sorted(D.keys())
count = 0
ans = 0
for time in times:
    count += D[time]
    ans = max(ans, count)
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

import math
import fractions
import heapq
import collections
import re
import array
import bisect

from collections import Counter, defaultdict


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]

II = lambda: int(input())
MI = lambda: map(int, input().split())


def main():
    N, C = MI()
    s_cnt = defaultdict(int)
    t_cnt = defaultdict(int)
    times = set()

    for i in range(N):
        s, t, c = MI()
        s_cnt[s-0.5] += 1
        times.add(s-0.5)
        t_cnt[t] += 1
        times.add(t)
    ans, cnt = 0, 0
    for t in sorted(times):
        cnt += s_cnt[t] - t_cnt[t]
        ans = max(ans, cnt)
    return ans


if __name__ == "__main__":
    print(main())

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
channel_list = [[0 for _ in range(2*(10**5)+1)]for _ in range(C)]
for i in range(N):
    s, t, c = map(int, input().split())
    channel_list[c-1][2*s-1] += 1
    channel_list[c-1][2*t] -= 1

for i in range(C):
    for t in range(2*(10**5)+1):
        if t == 2*(10 ** 5):
            continue
        channel_list[i][t+1] += channel_list[i][t]
x = 0
for t in range(2*(10**5)+1):
    count = 0
    for c in range(C):
        count += channel_list[c][t]
    if count > x:
        x = count
print(x)

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
channel_list = [[0 for _ in range(10**5+1)]for _ in range(C)]
for i in range(N):
    s, t, c = map(int, input().split())
    channel_list[c-1][s-1] += 1
    channel_list[c-1][t] -= 1

for i in range(C):
    for t in range(10**5+1):
        if t == 10 ** 5:
            continue
        channel_list[i][t+1] += channel_list[i][t]
x = 0
for t in range(10**5+1):
    count = 0
    for c in range(C):
        count += channel_list[c][t]
    if count > x:
        x = count
print(x)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
from operator import itemgetter

N,C = map(int, input().split())
record = []
for _ in range(N):
    s,t,c = map(int, input().split())
    record.append((s,t,c))
record.sort(key=itemgetter(1,0,2))

def can_record(k):
    slots = [(-1,-1)]*k  # (end_time, channel)

    for r in record:
        idx = -1
        t = -1
        for i in range(k):
            end_time, channel = slots[i]
            if channel==r[2]:
                if end_time<=r[0]:
                    if t<r[1]:
                        t = r[1]
                        idx = i
            else:
                if end_time<r[0]:
                    if t<r[1]:
                        t = r[1]
                        idx = i
        if idx==-1:
            return False
        else:
            slots[idx] = (r[1],r[2])
    return True

for k in range(1,C+1):
    if can_record(k):
        print(k)
        break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu Dec  6 20:35:59 2018

@author: owner
"""

from heapq import heappush, heappop
N,C=list(map(int,input().split()))

arr=[]
for _ in range(N):
    arr.append(list(map(int,input().split())))

arr=sorted(arr, key=lambda x:x[0])

ans=0
cnt=0
tmp=0
recorder = [(10**10,31)]

for x in arr:
    s, t, c=x
    while recorder[0][0]<s:
        heappop(recorder)
        cnt-=1
        cnt+=tmp
        tmp=0
    
    for i in range(len(recorder)):
        if recorder[i][0] !=t:
            break
        if recorder[i][1] ==c:
            cnt-=1
            tmp+=1
    heappush(recorder,(t,c))
    cnt+=1
    if ans < cnt:
        ans=cnt
            
print(ans)

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
N,C=list(map(int,input().split()))

arr=[]
for _ in range(N):
    arr.append(list(map(int,input().split())))

arr=sorted(arr, key=lambda x:x[0])

ans=0
cnt=0
tmp=0
recorder = [(10**20,31)]

for x in arr:
    s, t, c=x
    while recorder[0][0]<s:
        heappop(recorder)
        cnt-=1
        cnt+=tmp
        tmp=0
    
    for i in range(len(recorder)):
        if recorder[i][0] !=t:
            break
        if recorder[i][1] ==c:
            cnt-=1
            tmp+=1
    heappush(recorder,(t,c))
    cnt+=1
    if ans < cnt:
        ans=cnt
            
print(ans)

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
N,C=list(map(int,input().split()))

arr=[]
for _ in range(N):
    arr.append(list(map(int,input().split())))

arr=sorted(arr, key=lambda x:x[0])

ans=0
cnt=0
tmp=0
ch=[0 for _ in range(C)]
recorder = [(10**20,30)]

for x in arr:
    s, t, c=x
    while recorder[0][0]<s:
        heappop(recorder)
        cnt-=1
        cnt+=tmp
        tmp=0
    
    for i in range(len(recorder)):
        if recorder[i][0] != t:
            break
        if recorder[i][1] ==c:
            cnt-=1
            tmp+=1
    heappush(recorder,(t,c))
    cnt+=1
    if ans < cnt:
        ans=cnt
            
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
N, C = map( int, input().split())
timetable = [ [0]*(10**5+2) for _ in range(C+1)]
for _ in range(N):
    s, t, c = map( int, input().split())
    timetable[c][s-1:t] = [1]*(t-s+1)
# for c in range(1,C+1):
#     timetable[c] = list( accumulate(timetable[c]))
ans = 0
for i in range(1,10*5+1):
    now = 0
    for c in range(1,C+1):
        if timetable[c][i] > 0:
            now += 1
    ans = max( now, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
N, C = map( int, input().split())
timetable = [ [0]*(10**5+2) for _ in range(C+1)]
for _ in range(N):
    s, t, c = map( int, input().split())
    timetable[c][s-1] += 1
    timetable[c][t] -= 1
for c in range(1,C+1):
    timetable[c] = list( accumulate(timetable[c]))
ans = 0
for i in range(1,10*5+1):
    now = 0
    for c in range(1,C+1):
        if timetable[c][i] > 0:
            now += 1
    ans = max( now, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
N, C = map( int, input().split())
timetable = [ [0]*(10**5+2) for _ in range(C+1)]
for _ in range(N):
    s, t, c = map( int, input().split())
    timetable[c][s-1] += 1
    timetable[c][t] -= 1
for c in range(1,C+1):
    timetable[c] = list( accumulate(timetable[c]))
ans = 0
for i in range(1,10*5+1):
    now = 0
    for c in range(1,C+1):
        if timetable[c][i] > 0:
            now += 1
    ans = max( now, ans)
for c in range(1,C+1):
    print( timetable[c][:40])
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
N, C = map( int, input().split())
timetable = [ [0]*(10**5+2) for _ in range(C+1)]
for _ in range(N):
    s, t, c = map( int, input().split())
    timetable[c][s] += 1
    timetable[c][t+1] -= 1
for c in range(1,C+1):
    timetable[c] = list( accumulate(timetable[c]))
ans = 0
for i in range(1,10*5+1):
    now = 0
    for c in range(1,C+1):
        if timetable[c][i] > 0:
            now += 1
    ans = max( now, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
N, C = map( int, input().split())
timetable = [ [0]*(10**5+2) for _ in range(C+1)]
for _ in range(N):
    s, t, c = map( int, input().split())
    timetable[c][s-1] += 1
    timetable[c][t] -= 1
for c in range(1,C+1):
    timetable[c] = list( accumulate(timetable[c]))
ans = 0
for i in range(1,10*5+1):
    now = 0
    for c in range(1,C+1):
        if timetable[c][i] > 0:
            now += 1
    ans = max( now, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
N, C = map( int, input().split())
timetable = [ [0]*(10**5+2) for _ in range(C+1)]
for _ in range(N):
    s, t, c = map( int, input().split())
    timetable[c][s-1] += 1
    timetable[c][t+1] -= 1
for c in range(1,C+1):
    timetable[c] = list( accumulate(timetable[c]))
ans = 0
for i in range(1,10*5+1):
    now = 0
    for c in range(1,C+1):
        if timetable[c][i] > 0:
            now += 1
    ans = max( now, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
N, C = map( int, input().split())
timetable = [ [0]*(10**5+2) for _ in range(C+1)]
for _ in range(N):
    s, t, c = map( int, input().split())
    timetable[c][s] += 1
    timetable[c][t+1] -= 1
for c in range(1,C+1):
    timetable[c] = list( accumulate(timetable[c]))
ans = 0
for i in range(1,10*5+1):
    now = 0
    for c in range(1,C+1):
        if timetable[c][i] > 0:
            now += 1
    ans = max( now, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
N, C=map(int,input().strip().split(' '))
s=[]
t=[]
ch=[]
for i in range(N):
    st,tt,cht=map(int,input().strip().split(' '))
    s.append(10*st-5)
    t.append(10*tt)
    ch.append(cht)
ans=0
for i in range(N):
    st=s[i]
    tt=t[i]
    ct=1
    for j in range(N):
        if i!=j:
            if (s[j]<=st and st<t[j]) or (s[j]>=st and s[j]<tt):
                st=max(s[i],s[j])
                tt=min(t[i],t[j])
                ct+=1
    #print(ct)
    ans=max(ct,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
latest = 0
P = [[] for i in range(C)]
for i in range(N):
    s, t, c = map(int, input().split())
    P[c-1].append((s, t))
    latest = max(latest, t)

Dup = [0 for i in range(latest + 2)]
for i in range(C):
    for j in range(len(P[i])):
        Dup[P[i][j][0]] += 1
        Dup[P[i][j][1] + 1] -= 1
        if j >= 1:
            if P[i][j][0] == P[i][j-1][1]:
                Dup[P[i][j][0]] -= 1
                Dup[P[i][j][0] + 1] += 1
for i in range(1, latest + 2):
    Dup[i] += Dup[i-1]
print(max(Dup))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
latest = 0
P = [[] for i in range(C)]
for i in range(N):
    s, t, c = map(int, input().split())
    P[c-1].append((s, t))
    latest = max(latest, t)

Dup = [0 for i in range(latest + 2)]
for i in range(C):
    for j in range(len(P[i])):
        Dup[P[i][j][0]] += 1
        Dup[P[i][j][1] + 1] -= 1
        if j >= 1:
            if P[i][j][0] == P[i][j-1][1]:
                Dup[P[i][j][0] + 1] += 1
for i in range(1, latest + 2):
    Dup[i] += Dup[i-1]
print(max(Dup))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
Dup = [0 for i in range(100003)]
latest = 0
for i in range(N):
    s, t, c = map(int, input().split())
    Dup[s] += 1
    Dup[t+1] -= 1
    latest = max(latest, t)
maxC = 0
for i in range(1, latest + 1):
    Dup[i] += Dup[i-1]
    maxC = max(maxC, Dup[i])

print(maxC)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())
List=[[int(i) for i in input().split()] for i in range(N)]
Time=[[0]*(10**5+1)]*C
Set={0}
for i in range(N):
  c=List[i][2]
  s=List[i][0]
  t=List[i][1]
  T_c=list(Time[c-1])
  T_c[s-1:t]=[1]*(t-s+1)
  Time[c-1]=list(T_c)
  Set.add(s-1)
  Set.add(t)
T=0
T_max=0
for t in Set:
  for c in range(C):
    T+=Time[c][t]
  if T_max<T:
    T_max=T
  T=0
print(T_max-1)

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())
List=[[int(i) for i in input().split()] for i in range(N)]
Time=[[0]*(10**5+1)]*C
for i in range(N):
  c=List[i][2]
  s=List[i][0]
  t=List[i][1]
  T_c=list(Time[c-1])
  T_c[s-1:t]=[1]*(t-s+1)
  Time[c-1]=list(T_c)
T=0
T_max=0
for t in range(10**5+1):
  for c in range(C):
    T+=Time[c][t]
  if T_max<T:
    T_max=T
  T=0
print(T_max-1)

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())
List=[[int(i) for i in input().split()] for i in range(N)]
Time=[[0]*(10**5+1)]*C
for i in range(N):
  T_c=list(Time[List[i][2]-1])
  T_c[List[i][0]-1:List[i][1]]=[1]*(List[i][1]-List[i][0]+1)
  Time[List[i][2]-1]=list(T_c)
T=0
T_max=0
for t in range(10**5):
  for c in range(C):
    T+=Time[c][t]
  if T_max<T:
    T_max=T
  T=0
print(T_max-1)

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())
List=[[int(i) for i in input().split()] for i in range(N)]
Time=[[]]*C
for i in range(N):
  T_c=list(Time[List[i][2]-1])
  T_c+=[0]*(List[i][0]-1-len(T_c))
  T_c+=[1]*(List[i][1]-List[i][0]+2)
  Time[List[i][2]-1]=list(T_c)
T=0
T_max=0
for t in range(10**5):
  for c in range(C):
    if t+1<=len(Time[c]):
      T+=Time[c][t]
  if T_max<T:
    T_max=T
  T=0
print(T_max)

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c=map(int, input().split())
a=[list(map(int, input().split())) for  i in range(n)]
a.sort(key=lambda x: (x[2],x[0]))
ans=np.array([0]*3*10**5)
channel,last=0,0
for i,j,k in a:
    if channel==k and last==i:
        ans[i*2:j*2+1]+=1
        last=j
    else:
        ans[i*2-1:j*2+1]+=1
        last=j
        channel=k
print(ans.max())

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
M = 200005
rec = [0] * M
for i in range(N):
    s, t, c = map(int, input().split())
    rec[2 * s - 1] += 1
    rec[2 * t] -= 1

for i in range(1, M):
    rec[i] += rec[i - 1]

print(max(rec))

Submission status: Wrong Answer

Solution code:
n, c = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
x.sort()
rec = [x[0]]
for i in range(1, n):
    xx = x[i]
    flag = True
    for j in range(len(rec)):
        if rec[j][1] <= xx[0] - 0.5:
            rec[j] = xx
            flag = False
    if flag:
        rec.append(xx)
print(len(rec))

Submission status: Wrong Answer

Solution code:
from operator import attrgetter


class Data:
    def __init__(self, s, t, c):
        self.s = s
        self.t = t
        self.c = c


N, C = map(int, input().split())
data_list = []
for _ in range(N):
    s, t, c = map(int, input().split())
    data_list.append(Data(s, t, c))

ch_map = {}
for data in data_list:
    if data.c in ch_map:
        ch_map[data.c].append(data)
    else:
        ch_map[data.c] = [data]
data_list = []

m = {}
for key, val in ch_map.items():
    ch_list = sorted(val, key=attrgetter("s"))
    # m = {}
    end = 0
    for ch in ch_list:
        if end <= ch.s:
            for i in range(ch.s-1, ch.t):
                if i in m:
                    m[i] += 1
                else:
                    m[i] = 1
                # m[i] = 1
            end = ch.t
        elif end > ch.t:
            for i in range((end+1, ch.t)):
                if i in m:
                    m[i] += 1
                else:
                    m[i] = 1
                # m[i] = 1
            end = ch.t
    # ch_map[key] = m


max = 0
for key, val in m.items():
    if max < val:
        max = val

# print(ch_map)
'''
for i in range(100001):
    cnt = 0
    for key, val in ch_map.items():
        if i in val:
            cnt += 1
    if cnt > max:
        max = cnt
    cnt = 0
'''
print(max)

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
cum = [0]*(10**5+1)
d = {}
for i in range(10**5+1):
    d[i] = []
for i in range(N):
    s,t,c = map(int,input().split())
    if c not in d[s]:
        cum[s-1] += 1
        cum[t] -= 1
    else:
        cum[s] += 1
        cum[t] -= 1
    d[t].append(c)
import numpy as np
print(np.cumsum(cum).max())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
cum = [0]*(10**5+1)
d = {}
for i in range(10**5):
    d[i] = []
for i in range(N):
    s,t,c = map(int,input().split())
    if c not in d[s-1]:
        cum[s-1] += 1
        cum[t] -= 1
    else:
        cum[s] += 1
        cum[t] -= 1
    d[t-1].append(c)
import numpy as np
print(np.cumsum(cum).max())

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
cum = [0]*(10**5+1)
d = {}
for i in range(10**5):
    d[i] = []
for i in range(N):
    s,t,c = map(int,input().split())
    if c not in d[s-1]:
        cum[s-1] += 1
        cum[t] -= 1
        d[t-1].append(c)
    else:
        cum[s] += 1
        cum[t] -= 1
import numpy as np
print(np.cumsum(cum).max())

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
cum = [0]*(10**5+1)
for i in range(N):
    s,t,c = map(int,input().split())
    cum[s-1] += 1
    cum[t] -= 1
import numpy as np
print(np.cumsum(cum).max())

Submission status: Wrong Answer

Solution code:
n,c=map(int,input().split())
stc=[list(map(int,input().split())) for _ in range(n)]
s=[stc[i][0] for i in range(n)]
t=[stc[i][1] for i in range(n)]
c=[stc[i][2] for i in range(n)]
mst=max(max(s),max(t))
x=[0 for _ in range(mst+1)]
for i in range(n):
    x[stc[i][0]-1]+=1
    x[stc[i][1]]-=1
for i in range(1,mst+1):
    x[i]+=x[i-1]
print(max(x))

Submission status: Wrong Answer

Solution code:
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n, cc = getMN()
jikan = [0 for i in range(100002)]
for i in range(n):
    s, t, c = getlist()
    jikan[s] += 1
    jikan[t+1] -= 1

accum = [0]
for j in jikan:
    accum.append(accum[-1]+j)


print(max(accum))

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)]
mark = [[] for i in range(10**5+2)]
for i in range(n):
    flag = 0
    for j in mark[tv[i][0]]:
        if j == tv[i][2]:
            flag = 1
    if flag:
        imos[tv[i][0]+1] += 1
    else:
        imos[tv[i][0]] += 1
    imos[tv[i][1]+1] -= 1
    mark[tv[i][1]].append(tv[i][2])

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

print(max(imos[:-1]))

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
src = [list(map(int,input().split())) for i in range(N)]
MAX = 10**5
bucket = [[] for i in range(MAX+2)]
bucket2 = [set() for i in range(MAX+2)]
for s,t,c in src:
    bucket[s].append((t,c))
    bucket2[s].add(c)

imos = [0]*(MAX+2)

for s in range(MAX):
    for t,c in bucket[s]:
        imos[s-1] += 1
        if c in bucket2[s]:
            imos[t] -= 1
        else:
            imos[t-1] -= 1

ans = tmp = 0
for im in imos:
    tmp += im
    ans = max(ans, tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
N,C = map(int,input().split())
src = [list(map(int,input().split())) for i in range(N)]
MAX = 10**5
bucket = [[] for i in range(MAX+2)]
bucket2 = [set() for i in range(MAX+5)]
for s,t,c in src:
    bucket[s].append((t,c))
    bucket2[s].add(c)

imos = [0]*(MAX+2)

for s in range(MAX+1):
    for t,c in bucket[s]:
        imos[s-1] += 1
        if c in bucket2[s]:
            imos[t] -= 1
        else:
            imos[t-1] -= 1

ans = tmp = 0
for im in imos:
    tmp += im
    ans = max(ans, tmp)
print(ans)

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+1):
    imos[i+1] += imos[i]

print(max(imos[:-1]))