88592024-02-02 15:07:36kristofMekk Mester munkái (50 pont)python3Accepted 50/50546ms75268 KiB
megrendelesekSzama, napokSzama = (int(i) for i in input().split()) 
rendelesek = []

for i in range(megrendelesekSzama):
    asd = list(map(int, input().split()))
    asd.append(i+1)
    rendelesek.append(asd)

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

mekkUtolso = 0
fiaUtolso = 0
mekkL = []
fiaL = []

for value in rendelesek:
    if fiaUtolso>mekkUtolso:

        if fiaUtolso < value[0]:
            fiaUtolso = value[1]
            fiaL.append(str(value[2]))
            #print("fia", value, i)
        elif mekkUtolso < value[0]:
            mekkUtolso = value[1]
            mekkL.append(str(value[2]))
            #print("apa", value, i)
    else:
        if mekkUtolso < value[0]:
            mekkUtolso = value[1]
            mekkL.append(str(value[2]))
            #print("apa", value, i)
        elif fiaUtolso < value[0]:
            fiaUtolso = value[1]
            fiaL.append(str(value[2]))
            #print("fia", value, i)


print(len(mekkL), len(fiaL))
print(" ".join(mekkL))
print(" ".join(fiaL))
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/017ms11228 KiB
2Accepted0/054ms17956 KiB
3Accepted1/118ms12204 KiB
4Accepted1/118ms12092 KiB
5Accepted2/217ms11896 KiB
6Accepted2/217ms12032 KiB
7Accepted2/218ms12696 KiB
8Accepted2/217ms12804 KiB
9Accepted3/318ms12912 KiB
10Accepted1/121ms13628 KiB
11Accepted1/121ms13688 KiB
12Accepted2/221ms13800 KiB
13Accepted2/221ms13912 KiB
14Accepted2/223ms13884 KiB
15Accepted2/221ms13768 KiB
16Accepted3/321ms13868 KiB
17Accepted2/2529ms74396 KiB
18Accepted2/2465ms74652 KiB
19Accepted4/4546ms74672 KiB
20Accepted4/4528ms74852 KiB
21Accepted4/4469ms75036 KiB
22Accepted4/4537ms75200 KiB
23Accepted4/4537ms75268 KiB