85952024-01-22 21:38:09KezdőMekk Mester munkái (50 pont)python3Accepted 50/50416ms55924 KiB
from sys import stdin

def main():
    N,nap = [int(i) for i in input().split()]
    munka = [0]*N
    for i in range(N):
        k,v = [int(i) for i in stdin.readline().split()]
        munka[i] = [v,k,i+1]
    munka.sort()
    munka = [0] + munka

    D = [[],[]] #dolgozók
    R =[1, 1] #mikortól ér rá
    ki = 0 #ki kapja az aktuális munkát
    m = 1 #munka
    for i in range(1,N+1):
        if R[ki] > munka[i][1] and R[(ki+1)%2] <= munka[i][1]:
            ki = (ki+1)%2
        if R[ki] <= munka[i][1]:
            D[ki].append(munka[i][2])
            R[ki] = munka[i][0]+1

    print(len(D[0]), len(D[1]))
    print(*D[0])
    print(*D[1])
main()
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/018ms11888 KiB
2Accepted0/045ms16284 KiB
3Accepted1/117ms12228 KiB
4Accepted1/118ms12424 KiB
5Accepted2/217ms12668 KiB
6Accepted2/217ms12620 KiB
7Accepted2/218ms12976 KiB
8Accepted2/217ms12812 KiB
9Accepted3/317ms12824 KiB
10Accepted1/119ms13444 KiB
11Accepted1/120ms13836 KiB
12Accepted2/219ms13900 KiB
13Accepted2/220ms13888 KiB
14Accepted2/220ms13980 KiB
15Accepted2/220ms14424 KiB
16Accepted3/320ms14528 KiB
17Accepted2/2409ms54932 KiB
18Accepted2/2409ms54944 KiB
19Accepted4/4411ms54976 KiB
20Accepted4/4412ms54848 KiB
21Accepted4/4416ms55024 KiB
22Accepted4/4393ms55116 KiB
23Accepted4/4411ms55924 KiB