31102023-02-16 10:05:02fanibarkaiBenzinkút üzemeltetés (55)python3Wrong answer 1/5523ms14700 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)
                        sorted(os)
                        print(len(os), *os)
                        exit()
                  
SubtaskSumTestVerdictTimeMemory
base1/55
1Accepted0/017ms11272 KiB
2Wrong answer0/021ms12408 KiB
3Wrong answer0/317ms11820 KiB
4Partially correct1/317ms12168 KiB
5Wrong answer0/317ms12176 KiB
6Wrong answer0/317ms12080 KiB
7Wrong answer0/317ms12456 KiB
8Wrong answer0/317ms12664 KiB
9Wrong answer0/317ms12512 KiB
10Wrong answer0/317ms12784 KiB
11Wrong answer0/317ms12892 KiB
12Wrong answer0/320ms13768 KiB
13Wrong answer0/420ms13996 KiB
14Wrong answer0/420ms14160 KiB
15Wrong answer0/523ms14512 KiB
16Wrong answer0/620ms14436 KiB
17Wrong answer0/620ms14700 KiB