31392023-02-19 15:32:09TheLol02Benzinkút üzemeltetés (55)python3Wrong answer 0/5525ms14080 KiB
from sys import stdin, stdout
def main():
    adat = list(map(int, stdin.readline().split()))
    t = []
    e = []
    es = []
    for i in range(adat[0]):
        kut = (list(map(int,stdin.readline().split())))
        t.append(kut[0])
        e.append(kut[1])
        es.append(kut[1])
    es.sort()
    es.reverse()
    m = []
    ertek = 0
    tav = adat[1]*(-1)
    for elem in es:
        akt = t[e.index(elem)]
        if akt >= tav:
            if tav + adat[1] <= akt:
                m.append(e.index(elem)+1)
                tav = akt
                ertek += elem
        elif akt <= tav:
            if akt-adat[1] >= tav:
                m.append(e.index(elem)+1)
                tav = akt
                ertek += elem
    stdout.write(str(ertek)+"\n")
    stdout.write(str(len(m))+ " ")
    for i in range (len(m)):
        stdout.write(str(m[i])+ " ")
main()
SubtaskSumTestVerdictTimeMemory
base0/55
1Accepted0/017ms11308 KiB
2Wrong answer0/025ms11732 KiB
3Wrong answer0/317ms11492 KiB
4Wrong answer0/318ms11944 KiB
5Wrong answer0/317ms12064 KiB
6Wrong answer0/317ms12248 KiB
7Wrong answer0/317ms12364 KiB
8Wrong answer0/317ms12388 KiB
9Wrong answer0/318ms12728 KiB
10Wrong answer0/317ms12864 KiB
11Wrong answer0/317ms12932 KiB
12Wrong answer0/319ms13192 KiB
13Wrong answer0/420ms13688 KiB
14Wrong answer0/421ms13388 KiB
15Wrong answer0/521ms13788 KiB
16Wrong answer0/623ms13768 KiB
17Wrong answer0/624ms14080 KiB