31262023-02-19 00:25:27TheLol02Benzinkút üzemeltetés (55)python3Wrong answer 3/5530ms13768 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:
        th = t[e.index(elem)]
        eh = e[e.index(elem)]
        if th >= tav:
            if tav + adat[1] <= th:
                m.append(e.index(elem)+1)
                tav = th
                ertek += elem
        elif th <= tav:
            if tav-adat[1] >= adat[1]:
                m.append(e.index(elem)+1)
                tav = th
                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
base3/55
1Wrong answer0/017ms11296 KiB
2Wrong answer0/030ms11940 KiB
3Partially correct1/317ms11476 KiB
4Wrong answer0/317ms11680 KiB
5Partially correct1/317ms12072 KiB
6Partially correct1/317ms12236 KiB
7Wrong answer0/318ms12480 KiB
8Wrong answer0/317ms12400 KiB
9Wrong answer0/317ms13140 KiB
10Wrong answer0/317ms13368 KiB
11Wrong answer0/318ms13344 KiB
12Wrong answer0/321ms13356 KiB
13Wrong answer0/424ms13668 KiB
14Wrong answer0/426ms13692 KiB
15Wrong answer0/527ms13752 KiB
16Wrong answer0/630ms13768 KiB
17Wrong answer0/630ms13740 KiB