87612024-01-29 15:03:05petergalambosMekk Mester munkái (50 pont)python3Wrong answer 4/50702ms27920 KiB
N, H = [int(i) for i in input().split()]
M = [[] for i in range(N)]
N1 = [0]*(H+1)
N2 = [0]*(H+1)
K1 = []
K2 = []
for i in range(N):
    k,v = [int(i) for i in input().split()]
    M[i] = [v,k,i+1]

M.sort()
##print(M)

for m in M:
    if K1 != [] and m[0] == K1[-1][0]:
        if m[1] > K1[-1][1]:
            K1[-1] = m
    elif K2 != [] and m[0] == K2[-1][0]:
        if m[1] > K2[-1][1]:
            K2[-1] = m
    elif 1 not in N1[m[1]:m[0]+1]:
        K1.append(m)
        N1[m[1]:m[0]+1] = [1]*(m[0]-m[1]+1)
    elif 1 not in N2[m[1]:m[0]+1]:
        K2.append(m)
        N2[m[1]:m[0]+1] = [1]*(m[0]-m[1]+1)
##    print(N1,K1)
##    print(N2,K2)
##    print('-------------------------------')
print(len(K1),len(K2))
print(*[k[-1] for k in K1])
print(*[k[-1] for k in K2])
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/018ms11404 KiB
2Wrong answer0/0375ms15940 KiB
3Accepted1/168ms17656 KiB
4Accepted1/157ms17720 KiB
5Wrong answer0/261ms18024 KiB
6Wrong answer0/257ms18024 KiB
7Accepted2/250ms17932 KiB
8Wrong answer0/235ms18252 KiB
9Wrong answer0/318ms13036 KiB
10Wrong answer0/1397ms19536 KiB
11Wrong answer0/1386ms19252 KiB
12Wrong answer0/2360ms19464 KiB
13Wrong answer0/2301ms18972 KiB
14Wrong answer0/2252ms19416 KiB
15Wrong answer0/2171ms19540 KiB
16Wrong answer0/324ms13648 KiB
17Time limit exceeded0/2702ms27400 KiB
18Time limit exceeded0/2672ms27320 KiB
19Time limit exceeded0/4689ms27416 KiB
20Time limit exceeded0/4665ms27428 KiB
21Time limit exceeded0/4689ms27732 KiB
22Time limit exceeded0/4653ms27920 KiB
23Time limit exceeded0/4685ms27892 KiB