30832023-02-14 15:33:59fanibarkaiBenzinkút üzemeltetés (55)python3Wrong answer 1/5524ms14556 KiB
from sys import stdin, stdout
n, k = stdin.readline().split()
n = int(n)
k = int(k)
ta = dict(
      stdin.readline().split()
      for _ in range(n)
)
tn = list(ta)
ta = dict(sorted(ta.items(), key=lambda x:x[1], reverse = True))
os = [0]

for key, val in ta.items():
      t = int(key)
      os.append(tn.index(key)+1)
      os[0] = int(val)
      for ke, va in ta.items():
            if t != int(ke):
                  if int(ke) - t >= k or int(ke) - t <= -(k):
                        t = int(ke)
                        os.append(tn.index(ke)+1)
                        os[0] += int(va)

                  else:
                        stdout.write(str(os[0])+ "\n")
                        os.pop(0)
                        print(len(os), *os)
                        exit()
                  
SubtaskSumTestVerdictTimeMemory
base1/55
1Accepted0/017ms11304 KiB
2Wrong answer0/020ms12448 KiB
3Wrong answer0/317ms11832 KiB
4Partially correct1/317ms11704 KiB
5Wrong answer0/317ms12276 KiB
6Wrong answer0/317ms12408 KiB
7Wrong answer0/317ms12776 KiB
8Wrong answer0/317ms12952 KiB
9Wrong answer0/318ms13264 KiB
10Wrong answer0/317ms13260 KiB
11Wrong answer0/318ms13840 KiB
12Wrong answer0/320ms14084 KiB
13Wrong answer0/420ms14012 KiB
14Wrong answer0/420ms14440 KiB
15Wrong answer0/524ms14496 KiB
16Wrong answer0/621ms14556 KiB
17Wrong answer0/621ms14484 KiB