88562024-02-02 14:45:00petergalambosMekk Mester munkái (50 pont)python3Accepted 50/50518ms56096 KiB
N, H = [int(i) for i in input().split()]
M = [[] for i in range(N)]
K1 = []
K2 = []
for i in range(N):
    k,v = [int(i) for i in input().split()]
    M[i] = [v,k,i+1]

M.sort()

K2 = []
R1 = 0
R2 = 0
elso = True
for m in M:
    if elso:
        if m[1] > R1:
            K1.append(m)
            R1 = m[0]
        elif m[1] > R2:
            K2.append(m)
            R2 = m[0]
            elso = False
    else:
        if m[1] > R2:
            K2.append(m)
            R2 = m[0]
        elif m[1] > R1:
            K1.append(m)
            R1 = m[0]
            elso = True

print(len(K1),len(K2))
print(*[i[-1] for i in K1])
print(*[i[-1] for i in K2])
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/017ms11240 KiB
2Accepted0/052ms15620 KiB
3Accepted1/118ms12008 KiB
4Accepted1/118ms11876 KiB
5Accepted2/217ms11972 KiB
6Accepted2/217ms12236 KiB
7Accepted2/218ms12368 KiB
8Accepted2/217ms12472 KiB
9Accepted3/318ms12612 KiB
10Accepted1/120ms13180 KiB
11Accepted1/121ms13356 KiB
12Accepted2/220ms13372 KiB
13Accepted2/220ms13348 KiB
14Accepted2/220ms13340 KiB
15Accepted2/220ms13644 KiB
16Accepted3/321ms13960 KiB
17Accepted2/2448ms53748 KiB
18Accepted2/2460ms53724 KiB
19Accepted4/4462ms53680 KiB
20Accepted4/4458ms53868 KiB
21Accepted4/4465ms54144 KiB
22Accepted4/4474ms54088 KiB
23Accepted4/4518ms56096 KiB