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:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [0] * (100002)
for i in range(N):
    s, t, c = map(int, input().split())
    table[s] += 1
    table[t + 1] -= 1

ans = 0
for i in range(1, 100002):
    table[i] += table[i - 1]
    ans = max(ans, table[i])

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [0] * (10 ** 5 + 10)
for i in range(N):
    s, t, c = map(int, input().split())
    table[s] += 1
    table[t + 1] -= 1

ans = 0
for i in range(1, 10 ** 5 + 10):
    table[i] += table[i - 1]
    ans = max(ans, table[i])

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [0] * (10 ** 5 + 2)
for i in range(N):
    s, t, c = map(int, input().split())
    table[s] += 1
    table[t + 1] -= 1

ans = 0
for i in range(1, 10 ** 5 + 2):
    table[i] += table[i - 1]
    ans = max(ans, table[i])

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5 + 2)]
for i in range(N):
    s, t, c = map(lambda x: int(x) - 1, input().split())
    table[s][c] += 1
    table[t + 1][c] -= 1


ans = 0
for i in range(1, 10 ** 5 + 2):
    for j in range(C):
        table[i][j] += table[i - 1][j]
    ans = max(ans, sum(table[i]))

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5 + 1)]
for i in range(N):
    s, t, c = map(lambda x: int(x) - 1, input().split())
    table[s][c] += 1
    table[t + 1][c] -= 1


ans = 0
for i in range(1, 10 ** 5):
    for j in range(C):
        table[i][j] += table[i - 1][j]
    ans = max(ans, sum(table[i]))

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[s - 1][c - 1] = 1
    table[t - 1][c - 1] = -1

ans = 0
for i in range(1, 10 ** 5):
    for j in range(C):
        if table[i - 1][j] == 1 and table[i][j] == 0:
            table[i][j] = 1
    ans = max(ans, sum(map(lambda x: abs(x), table[i])))

print(max(ans, sum(table[0])))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5 + 2)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[s][c - 1] = 1
    table[t][c - 1] = -1

ans = 0
for i in range(1, 10 ** 5 + 2):
    for j in range(C):
        if table[i - 1][j] == 1 and table[i][j] == 0:
            table[i][j] = 1
    ans = max(ans, sum(map(lambda x: abs(x), table[i])))

print(ans)

Submission status: Wrong Answer

Solution code:
N, C = map(int,input().split())
a = [list(map(int,input().split())) for i in range(N)]
p = 0
for i in range(N-1):
    for j in range(1,N):
        if a[i][2] == a[j][2]:
            if a[i][1] == a[j][0]:
                a[i][1] = a[j][1]
                a[j] = a[i]
            elif a[i][0] == a[j][1]:
                a[i][0] = a[j][0]
                a[j] = a[i]
        else:
            if a[i][0] >= a[j][0]:
                if a[i][0] <= a[j][1]:
                    p += 1
            elif a[i][0] < a[j][0]:
                if a[i][1] >= a[j][0]:
                    p += 1
print(p)

Submission status: Wrong Answer

Solution code:
import numpy as np

N, C = map(int, input().split(' '))
s = []
t = []
c = []
for i in range(N):
    s_i, t_i, c_i = map(int, input().split(' '))
    s.append(s_i)
    t.append(t_i)
    c.append(c_i - 1)
T = 2*max(t)
table = np.zeros(T)
for i in range(C):
    table_i = np.zeros(T)
    for j in range(N):
        if c[j] == i:
            table_i[2*s[j]-1: 2*t[j]] = 1
print(int(np.max(table)))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5 + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[s][c - 1] = 1
    table[t][c - 1] = -1

ans = 0
for i in range(1, 10 ** 5 + 1):
    for j in range(C):
        if table[i - 1][j] == 1 and table[i][j] == 0:
            table[i][j] = 1
    ans = max(ans, sum(map(lambda x: abs(x), table[i])))

print(ans)

Submission status: Wrong Answer

Solution code:
from heapq import heapreplace, heappush

n, v = map(int, input().split())
programs = [tuple(map(int, input().split())) for _ in range(n)]
programs.sort()
tmp = [None] * v
combined = []
for s, t, c in programs:
    c -= 1
    prev = tmp[c]
    if prev is not None:
        ps, pt, pc = prev
        if pt == s:
            tmp[c] = (ps, t, c)
        else:
            combined.append((ps, pt, pc))
    else:
        tmp[c] = (s, t, c)
for prev in tmp:
    if prev is not None:
        combined.append(prev)
combined.sort()

recorders = [(-1, None)]
for s, t, c in combined:
    end, channel = recorders[0]
    if end < s or c == channel:
        heapreplace(recorders, (t, c))
    else:
        heappush(recorders, (t, c))
print(len(recorders))

Submission status: Wrong Answer

Solution code:
import numpy as np

N, C = map(int, input().split(' '))
s = []
t = []
c = []
for i in range(N):
    s_i, t_i, c_i = map(int, input().split(' '))
    s.append(s_i)
    t.append(t_i)
    c.append(c_i)
T = 2*max(t)
# for i in range(N):
#     table[2*s[i]-1: 2*t[i]] += 1
table = np.zeros(T)
for i in range(C):
    table_i = np.zeros(T)
    for j in range(N):
        if c[j] == i:
            table_i[2*s[j]: 2*t[j]] += 1
    table += table_i
print(int(np.max(table)))

Submission status: Wrong Answer

Solution code:
import sys

line = sys.stdin.readline()
N, C = [int(x) for x in line.strip().split()]

STC = []

for i in range(N):
    line = sys.stdin.readline().strip()
    xs = [int(x) for x in line.split()] + [0]
    STC.append(xs)

STC.sort(key=(lambda x:(x[0],x[1])))

vs = [[0, 0]]

for x in STC:
    for v in vs:
        if x[0] - 0.5 * (v[1] != x[2]) > v[0]:
            v[0] = x[1]
            v[1] = x[2]
            break
    else:
        vs.append([x[1], x[2]])

print(len(vs))

Submission status: Wrong Answer

Solution code:
import sys

line = sys.stdin.readline()
N, C = [int(x) for x in line.strip().split()]

STC = []

for i in range(N):
    line = sys.stdin.readline().strip()
    xs = [int(x) for x in line.split()] + [0]
    STC.append(xs)

STC.sort(key=(lambda x:(x[0],x[1])))

vs = [[0, 0]]

for x in STC:
    for v in vs:
        if x[0] - 0.5 * (v[1] != x[2]) > v[0]:
            v[0] = x[1]
            v[1] = x[2]
            break
    else:
        vs.append([x[1], x[2]])

print(vs)

Submission status: Wrong Answer

Solution code:
import numpy as np

N, C = map(int, input().split(' '))
s = []
t = []
c = []
for i in range(N):
    s_i, t_i, c_i = map(int, input().split(' '))
    s.append(s_i)
    t.append(t_i)
    c.append(c_i)
T = 2*max(t)
table = np.zeros(T)
# for i in range(N):
#     table[2*s[i]-1: 2*t[i]] += 1
for i in range(C):
    for j in range(N):
        if c[j] == i:
            table[2*s[j]: 2*t[j]] += 1
print(int(np.max(table)))

Submission status: Wrong Answer

Solution code:
import numpy as np

N, C = map(int, input().split(' '))
s = []
t = []
c = []
for i in range(N):
    s_i, t_i, c_i = map(int, input().split(' '))
    s.append(s_i)
    t.append(t_i)
    c.append(c_i)
T = 2*max(t)
table = np.zeros(T)
# for i in range(N):
#     table[2*s[i]-1: 2*t[i]] += 1
for i in range(C):
    for j in range(N):
        if c[j] == i:
            table[2*s[j]-1: 2*t[j]] += 1
print(int(np.max(table)))

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
tmp = -1
for i in range(len(c)):
    c[i].sort()
    for j in range(len(c[i])):
        for k in range(c[i][j][1] - c[i][j][0] + 1):
            if(c[i][j][0] + k - 1 != tmp):
                a[c[i][j][0] + k - 1] += 1
            tmp = c[i][j][1] - 1
print(max(a))

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
tmp = -1
for i in range(len(c)):
    c[i].sort()
    for j in range(len(c[i])):
        for k in range(c[i][j][1] - c[i][j][0] + 1):
            if(c[i][j][0] + k - 1 != tmp - 1):
                a[c[i][j][0] + k - 1] += 1
            tmp = c[i][j][1]
print(max(a))

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
tmp = -1
for i in range(len(c)):
    c[i].sort()
    for j in range(len(c[i])):
        for k in range(c[i][j][1] - c[i][j][0] + 1):
            if(c[i][j][0] + k - 1 != tmp - 1):
                a[c[i][j][0] + k - 1] += 1
                print(a[c[i][j][0] + k - 1], c[i][j][0] + k - 1, tmp)
            tmp = c[i][j][1]
print(max(a))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku = [0] * 200002
for s,t,c in timeTable:
    if s == 0:
        for i in range(2*t):
            sutyoku[i] += 1
    else:
        for i in range(2*s-1,2*t):
            sutyoku[i] += 1

print(max(sutyoku))

Submission status: Wrong Answer

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

print(max(sutyoku))

Submission status: Wrong Answer

Solution code:
import heapq
 
heap = []
rec = 1
margin = 0
 
N,C = map(int,input().split(" "))
info = [(0,0,0)] * N
 
for i in range(N):
	a,b,c = map(int,input().split(" "))
	info[i] = (a,b,c)
 
info.sort()
 
heapq.heappush(heap,info[0][1])
for i in range(1,N):
	if (2 * heap[0]) <= ((2 * info[i][0]) - 1):
		heapq.heappop(heap)
 
		while True:
			if heap == []:
				break
			elif (2 * heap[0]) > (2 * info[i][0] - 1):
				break
			else:
				margin += 1
				heapq.heappop(heap)
 
		heapq.heappush(heap,info[i][1])
 
	else:
		if margin <= 0:
			rec += 1
		else:
			margin -= 1
 
		heapq.heappush(heap,info[i][1])
 
print(rec)

Submission status: Wrong Answer

Solution code:
import heapq
 
heap = []
rec = 1
margin = 0
 
N,C = map(int,input().split(" "))
info = [(0,0,0)] * N
 
for i in range(N):
	a,b,c = map(int,input().split(" "))
	info[i] = (a,b,c)
 
info.sort()
 
heapq.heappush(heap,info[0][1])
for i in range(1,N):
	if (heap[0] <= (float(info[i][0]) - 0.5)):
		heapq.heappop(heap)
 
		while True:
			if heap == []:
				break
			elif (heap[0] > float(info[i][0] - 0.5)):
				break
			else:
				margin += 1
				heapq.heappop(heap)
 
		heapq.heappush(heap,info[i][1])
 
	else:
		if margin <= 0:
			rec += 1
		else:
			margin -= 1
 
		heapq.heappush(heap,info[i][1])
 
print(rec)

Submission status: Wrong Answer

Solution code:
import numpy as np

N, C = map(int, input().split(' '))
s = []
t = []
for i in range(N):
    s_i, t_i, c_i = map(int, input().split(' '))
    s.append(s_i)
    t.append(t_i)
T = 2*max(t)+1
table = np.zeros(T)
for i in range(N):
    table[2*s[i]: 2*t[i]+1] += 1
print(int(np.max(table)))

Submission status: Wrong Answer

Solution code:
from heapq import heapreplace, heappush

n, v = map(int, input().split())
programs = [tuple(map(int, input().split())) for _ in range(n)]
programs.sort()
recorders = [(-1, None)]
for s, t, c in programs:
    c -= 1
    end, channel = recorders[0]
    if end < s or c == channel:
        heapreplace(recorders, (t, c))
    else:
        heappush(recorders, (t, c))
print(len(recorders))

Submission status: Wrong Answer

Solution code:
import numpy as np

N, C = map(int, input().split(' '))
s = []
t = []
for i in range(N):
    s_i, t_i, c_i = map(int, input().split(' '))
    s.append(s_i)
    t.append(t_i)
T = 2*max(t)
table = np.zeros(T)
for i in range(N):
    table[2*s[i]: 2*t[i]] += 1
print(int(np.max(table)))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku = [0] * (10**5)*2

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

print(max(sutyoku))

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku = [0] * (10**5)*2

for s,t,c in timeTable:
    for i in range(s-1,t):
        sutyoku[i] += 1
print(max(sutyoku))

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
tmp = -1
for i in range(len(c)):
    c[i].sort()
    #print(c[i])
    for j in range(len(c[i])):
        for k in range(c[i][j][1] - c[i][j][0] + 1):
            if(c[i][j][0] + k - 1 != tmp):
                
                a[c[i][j][0] + k - 1] += 1
                #print(a[c[i][j][0] + k - 1], c[i][j][0] + k - 1)
        tmp = c[i][j][1]
print(max(a))

Submission status: Wrong Answer

Solution code:
print

Submission status: Wrong Answer

Solution code:
import sys

DBG_FLAG = 0

def p_dbg(str):
    if(DBG_FLAG == 1):
        sys.stdout.flush()
        print str

[N, C] = map(int, raw_input().split())

array_prog = []
for i in range(N):
    prg_n = map(int, raw_input().split())
    array_prog.append(prg_n)

max_num = 1
for prg_n in array_prog:
    num = 1
    for other in array_prog:
        p_dbg(prg_n)
        p_dbg(other)
        if prg_n == other:
            continue
        if (float(prg_n[0]) -0.5) <= other[1] and prg_n[1] > other[0]:
            num = num + 1
            p_dbg('+1 ch.')
    if max_num < num:
        max_num = num

print max_num

Submission status: Wrong Answer

Solution code:
M, N = map(int,input().split())
tvlist = [list(map(int,input().split())) for i in range(M)]
print(tvlist)
p = 1
for i in range(M-1):
    for j in range(M-2):
        if tvlist[i][2] != tvlist[j+1][2]:
            if tvlist[i][0] >= tvlist[j+1][0]:
                if tvlist[j+1][1] >= tvlist[i][0]:
                    p += 1
                    break
            elif tvlist[j+1][0] >= tvlist[i][0]:    
                if tvlist[i][1] >= tvlist[j+1][0]:
                    p += 1
                    break
        i = j + 1
        j += 2
print(p)

Submission status: Wrong Answer

Solution code:
import numpy as np

time = np.zeros(2*10**5+10, dtype='int32')
n, c = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N, C = map(int, input().split(' '))
s = []
t = []
for i in range(N):
    s_i, t_i, c_i = map(int, input().split(' '))
    s.append(s_i)
    t.append(t_i)
T = max(t)
table = np.zeros(2*T+1)
for i in range(N):
    table[2*s[i]-1: 2*t[i]+1] += 1
print(int(np.max(table)))

Submission status: Wrong Answer

Solution code:
import sys

DBG_FLAG = 0

def p_dbg(str):
    if(DBG_FLAG == 1):
        sys.stdout.flush()
        print str

[N, C] = map(int, raw_input().split())

array_prog = []
for i in range(N):
    prg_n = map(int, raw_input().split())
    array_prog.append(prg_n)

max_num = 0
for prg_n in array_prog:
    num = 0
    for other in array_prog:
        p_dbg(prg_n)
        p_dbg(other)
        if prg_n == other:
            continue
        if (float(prg_n[0]) -0.5) <= other[1] and prg_n[1] > other[0]:
            num = num + 1
            p_dbg('+1 ch.')
    if max_num < num:
        max_num = num

print max_num

Submission status: Wrong Answer

Solution code:
import numpy as np

time = np.zeros(10**5+2, dtype='int32')
n, c = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku = [0] * (10**5)

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

print(max(sutyoku))

Submission status: Wrong Answer

Solution code:
import heapq

heap = []
rec = 1


N,C = map(int,input().split(" "))
info = [(0,0,0)] * N

for i in range(N):
	a,b,c = map(int,input().split(" "))
	info[i] = (a,b,c)

info.sort()

heapq.heappush(heap,info[0][1])
margin = 0

for i in range(1,N):

	while True:
		if heap == []:
			break
		elif (heap[0] > info[i][0] - 0.5):
			break
		else:
			margin += 1
			heapq.heappop(heap)

		heapq.heappush(heap,info[i][1])
		margin -= 1

	else:
		if margin <= 0:
			rec += 1
		else:
			margin -= 1

		heapq.heappush(heap,info[i][1])

print(rec)

Submission status: Wrong Answer

Solution code:
import numpy as np

N, C = map(int, input().split(' '))
s = []
t = []
for i in range(N):
    s_i, t_i, c_i = map(int, input().split(' '))
    s.append(s_i)
    t.append(t_i)
T = max(t)
table = np.zeros(2*T)
# schedule = np.zeros(2*T)
for i in range(N):
    # schedule[:] = 0
    # schedule[2*s[i]-1: 2*t[i]] = 1
    table[2*s[i]-1: 2*t[i]] += 1
print(int(np.max(table)))

Submission status: Wrong Answer

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

ss = [0] * N
tt = [0] * N
cc = [0] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

timeline = [[0] * (10 ** 5 + 2) for c in range(C)]

# print(len(timeline), len(timeline[0]))
for n in range(N):
    timeline[cc[n] - 1][ss[n]] += 1
    timeline[cc[n] - 1][tt[n]] -= 1

for c in range(C):
    for t in range(10 ** 5 + 2):
        if timeline[c][t] > 0:
            timeline[c][t - 1] = timeline[c][t]
            timeline[c][t] = 0
max_ = 0
stack = 0
for t in range(10 ** 5 + 2):
    for c in range(C):
        stack += timeline[c][t]
    if stack > max_:
        max_ = stack

print(max_)

# 3 2
# 1 3 1
# 3 4 1
# 4 5 2

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku = [0] * (10**5)

for s,t,c in timeTable:
    for i in range(s-1,t):
        sutyoku[i] += 1

print(max(sutyoku))

Submission status: Wrong Answer

Solution code:
import sys

line = sys.stdin.readline()
N, C = [int(x) for x in line.strip().split()]

STC = []

for i in range(N):
    line = sys.stdin.readline().strip()
    xs = [int(x) for x in line.split()] + [0]
    STC.append(xs)

STC.sort(key=(lambda x:(x[1],x[0])))

r = 0
n = 0
while n < N:
    t = 0
    c = 0
    i = 0
    while i < len(STC):
        x = STC[i]
        if x[3] == 1:
            i += 1
            continue
        xt = x[0]
        if x[2] != c:
            xt -= 0.5
        if t <= xt:
            j = i
            while j < len(STC):
                if STC[j][1] == x[1] and x[2] == c:
                    i = j
                    x = STC[i]
                    break
                if STC[j][1] > x[1]:
                    break
                j += 1
            # print(r, t, c, x)
            t = x[1]
            c = x[2]
            x[3] = 1
            n += 1
        i += 1
    r += 1

print(r)

Submission status: Wrong Answer

Solution code:
N,C=[int(i) for i in input().split()]

bangumi_list=[]
last=0
for i in range(N):
    s,t,c=[int(i) for i in input().split()]
    bangumi_list.append([s,t,c])
    if last<t:
        last=t

kaburi=[0 for i in range(2*last+1)]
for bangumi in bangumi_list:
    for i in range(2*bangumi[0]-1,2*bangumi[1]):
        # print(bangumi,i)
        kaburi[i]+=1

max_kaburi=0
for i in range(2+last+1):
    if max_kaburi<kaburi[i]:
        max_kaburi=kaburi[i]
print(max_kaburi)

Submission status: Wrong Answer

Solution code:
import numpy as np

time = np.zeros(10**5+2, dtype='int16')
n, c = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
import heapq

heap = []
rec = 1


N,C = map(int,input().split(" "))
info = [(0,0,0)] * N

for i in range(N):
	a,b,c = map(int,input().split(" "))
	info[i] = (a,b,c)

info.sort()

heapq.heappush(heap,info[0][1])
margin = 0

for i in range(1,N):
	if heap[0] <= info[i][0] - 0.5:
		heapq.heappop(heap)
		margin += 1

		while True:
			if heap == []:
				break
			elif (heap[0] > info[i][0] - 0.5):
				break
			else:
				margin += 1
				heapq.heappop(heap)

		heapq.heappush(heap,info[i][1])
		margin -= 1

	else:
		if margin >= 0:
			rec += 1
		else:
			margin -= 1

		heapq.heappush(heap,info[i][1])

print(rec)

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
tmp = -1
for i in range(len(c)):
    c[i].sort()
    for j in range(len(c[i])):
        for k in range(c[i][j][1] - c[i][j][0] + 1):
            if(a[c[i][j][0] + k - 1] != tmp):
                a[c[i][j][0] + k - 1] += 1
        tmp = c[i][j][1]
print(max(a))

Submission status: Wrong Answer

Solution code:
import sys

line = sys.stdin.readline()
N, C = [int(x) for x in line.strip().split()]

STC = []

for i in range(N):
    line = sys.stdin.readline().strip()
    xs = [int(x) for x in line.split()] + [0]
    STC.append(xs)

STC.sort(key=(lambda x:(x[1],x[2])))

r = 0
n = 0
while n < N:
    t = 0
    c = 0
    i = 0
    while i < len(STC):
        x = STC[i]
        if x[3] == 1:
            i += 1
            continue
        xt = x[0]
        if x[2] != c:
            xt -= 0.5
        if t <= xt:
            j = i
            while j < len(STC):
                if STC[j][1] == x[1] and x[2] == c:
                    i = j
                    x = STC[i]
                    break
                if STC[j][1] > x[1]:
                    break
                j += 1
            # print(r, t, c, x)
            t = x[1]
            c = x[2]
            x[3] = 1
            n += 1
        i += 1
    r += 1

print(r)

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
for i in range(len(c)):
    c[i].sort()
    for j in range(len(c[i])):
        tmp = -1
        for k in range(c[i][j][1] - c[i][j][0] + 1):
            if(a[c[i][j][0] + k - 1] != tmp):
                a[c[i][j][0] + k - 1] += 1
        tmp = c[i][j][1]
print(max(a))

Submission status: Wrong Answer

Solution code:
import sys

line = sys.stdin.readline()
N, C = [int(x) for x in line.strip().split()]

STC = []

for i in range(N):
    line = sys.stdin.readline().strip()
    xs = [int(x) for x in line.split()] + [0]
    STC.append(xs)

STC.sort(key=(lambda x:(x[1],x[2])))

r = 0
n = 0
while n < N:
    t = 0
    c = 0
    i = 0
    while i < len(STC):
        x = STC[i]
        if x[3] == 1:
            i += 1
            continue
        xt = x[0]
        if x[2] != c:
            xt -= 0.5
        if t <= xt:
            j = i
            while j < len(STC):
                if STC[j][1] == x[1] and x[2] == c:
                    i = j
                    break
                if STC[j][1] > x[1]:
                    break
                j += 1
            # print(r, t, c, x)
            t = x[1]
            c = x[2]
            x[3] = 1
            n += 1
        i += 1
    r += 1

print(r)

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
for i in range(len(c)):
    tmp = 10**5*[0]
    c[i].sort()
    for j in range(len(c[i])):
        tmp = c[i][j][1]
        for k in range(c[i][j][1] - c[i][j][0] - 1):
            if(a[c[i][j][0] + k - 1] != tmp):
                a[c[i][j][0] + k - 1] += 1
print(max(a))

Submission status: Wrong Answer

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

T=0
for i in A:
    T=max(i[1],T)
    
timelist=[0 for _ in range((T)*2)]

for item in A:
    starttime=item[0]
    endtime=item[1]
    for time in range(starttime*2-2,endtime*2-2,2):
        timelist[time]+=1
        timelist[time+1]+=1
    timelist[time+2]+=1
print(max(timelist))

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
for i in range(len(c)):
    tmp = 10**5*[0]
    c[i].sort()
    for j in range(len(c[i])):
        tmp = c[i][j][1] + 1
        for k in range(c[i][j][1] - c[i][j][0] + 1):
            if(a[c[i][j][0] + k - 1] != tmp):
                a[c[i][j][0] + k - 1] += 1
print(max(a))

Submission status: Wrong Answer

Solution code:
N,C=list(map(int,input().split()))
A=[list(map(int,input().split())) for _ in range(N)]
 
T=0
for i in A:
    T=max(i[1],T)
timelist=[0 for _ in range((T)*2)]
for item in A:
    starttime=item[0]
    endtime=item[1]
    for time in range(starttime*2-2,endtime*2-1,2):
        timelist[time]+=1
        timelist[time+1]+=1
print(max(timelist))

Submission status: Wrong Answer

Solution code:
import heapq

heap = []
rec = 1
margin = 0

N,C = map(int,input().split(" "))
info = [(0,0,0)] * N

for i in range(N):
	a,b,c = map(int,input().split(" "))
	info[i] = (a,b,c)

info.sort()

heapq.heappush(heap,info[0][1])
for i in range(1,N):
	if heap[0] <= info[i][0] - 0.5:
		heapq.heappop(heap)
		margin += 1

		while True:
			if heap == []:
				break
			elif (heap[0] > info[i][0] - 0.5):
				break
			else:
				margin += 1
				heapq.heappop(heap)

		heapq.heappush(heap,info[i][1])

	else:
		if margin == 0:
			rec += 1
		else:
			margin -= 1

		heapq.heappush(heap,info[i][1])

print(rec)

Submission status: Wrong Answer

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

table=[0]*10**5
for _ in range(N):
  s,t,c=map(int,raw_input().split(' '))
  i=s
  while i<t:
    table[i]+=1
    i+=1

print max(table)

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
for i in range(len(c)):
    tmp = 10**5*[0]
    c[i].sort()
    for j in range(len(c[i])):
        tmp = c[i][j][1] - 1
        for k in range(c[i][j][1] - c[i][j][0] + 1):
            if(a[c[i][j][0] + k - 1] != tmp):
                a[c[i][j][0] + k - 1] += 1
        tmp = -1
print(max(a))

Submission status: Wrong Answer

Solution code:
import heapq

heap = []
rec = 1
margin = 0

N,C = map(int,input().split(" "))
info = [(0,0,0)] * N

for i in range(N):
	a,b,c = map(int,input().split(" "))
	info[i] = (a,b,c)

info.sort()

heapq.heappush(heap,info[0][1])
for i in range(1,N):
	if heap[0] <= info[i][0] - 0.5:
		heapq.heappop(heap)

		while True:
			if heap == []:
				break
			elif (heap[0] > info[i][0] - 0.5):
				break
			else:
				margin += 1
				heapq.heappop(heap)

		heapq.heappush(heap,info[i][1])

	else:
		if margin == 0:
			rec += 1
		else:
			margin -= 1

		heapq.heappush(heap,info[i][1])

print(rec)

Submission status: Wrong Answer

Solution code:
N,C=list(map(int,input().split()))
A=[list(map(int,input().split())) for _ in range(N)]
 
T=0
for i in A:
    T=max(i[1],T)
timelist=[0 for _ in range((T)*2)]
for item in A:
    starttime=item[0]
    endtime=item[1]
    for time in range(starttime*2-2,endtime*2,2):
        timelist[time]+=1
        timelist[time+1]+=1
print(max(timelist))

Submission status: Wrong Answer

Solution code:
n, c_no = list(map(int, input().split()))
s, t = [], []
c = []
for i in range(c_no):
    c.append([])
for i in range(n):
    stc = list(map(int, input().split()))
    c[stc[2] - 1].append([stc[0], stc[1]])
a = 10**5*[0]
for i in range(len(c)):
    tmp = 10**5*[0]
    c[i].sort()
    for j in range(len(c[i])):
        tmp = c[i][j][1]
        for k in range(c[i][j][1] - c[i][j][0] + 1):
            if(a[c[i][j][0] + k - 1] != tmp):
                a[c[i][j][0] + k - 1] += 1
        tmp = -1
print(max(a))