84142024-01-15 17:47:50birozsMekk Mester munkái (50 pont)python3Wrong answer 38/50544ms69284 KiB
'''
be = open("be2.txt")
N,H = map(int,be.readline().split())
lista = []
for i in range(N):
    tol,ig = map(int,be.readline().split())
    lista.append([tol,ig,i+1])
be.close()
'''
N,H = map(int,input().split())
lista = []
for i in range(N):
    tol,ig = map(int,input().split())
    lista.append([tol,ig,i+1])

lista.sort(key=lambda x:(x[1],x[0]))
if N == 1:
    print(1,0)
    print(1)
    print()
elif N == 2:
    print(1,1)
    print(1)
    print(1)
else:
    Mester = [lista[0][2]]
    Fia = [lista[1][2]]
    Mvege = lista[0][1]
    Fvege = lista[1][1]
    for i in range(2,N):
        if lista[i][0] > Mvege and lista[i][0] > Fvege:
            if lista[i][0] - Mvege <= lista[i][0] - Fvege:
                Mvege = lista[i][1]
                Mester.append(lista[i][2])
            else:
                Fvege = lista[i][1]
                Fia.append(lista[i][2])
        elif lista[i][0] > Mvege:
            Mvege = lista[i][1]
            Mester.append(lista[i][2])
        elif lista[i][0] > Fvege:
            Fvege = lista[i][1]
            Fia.append(lista[i][2])

print(len(Mester),len(Fia))
for x in Mester:
    print(x,end=" ")
print()
for x in Fia:
    print(x,end=" ")
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/019ms11452 KiB
2Accepted0/056ms17464 KiB
3Accepted1/118ms11848 KiB
4Accepted1/118ms12028 KiB
5Accepted2/218ms12120 KiB
6Accepted2/218ms12148 KiB
7Accepted2/218ms12360 KiB
8Wrong answer0/217ms12860 KiB
9Accepted3/317ms12680 KiB
10Accepted1/120ms13436 KiB
11Accepted1/121ms13344 KiB
12Accepted2/221ms13780 KiB
13Accepted2/223ms13764 KiB
14Accepted2/223ms13812 KiB
15Wrong answer0/224ms14168 KiB
16Accepted3/323ms14076 KiB
17Accepted2/2512ms68536 KiB
18Accepted2/2519ms68948 KiB
19Wrong answer0/4469ms69128 KiB
20Wrong answer0/4518ms69212 KiB
21Accepted4/4519ms69284 KiB
22Accepted4/4472ms69168 KiB
23Accepted4/4544ms69160 KiB