30822023-02-14 15:30:08fanibarkaiBenzinkút üzemeltetés (55)python3Wrong answer 1/5523ms14880 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/018ms11364 KiB
2Wrong answer0/020ms12464 KiB
3Wrong answer0/317ms11648 KiB
4Partially correct1/317ms12040 KiB
5Wrong answer0/318ms12204 KiB
6Wrong answer0/317ms12372 KiB
7Wrong answer0/317ms12456 KiB
8Wrong answer0/318ms12604 KiB
9Wrong answer0/318ms12876 KiB
10Wrong answer0/317ms13012 KiB
11Wrong answer0/317ms13104 KiB
12Wrong answer0/320ms13784 KiB
13Wrong answer0/421ms14116 KiB
14Wrong answer0/420ms14296 KiB
15Wrong answer0/523ms14628 KiB
16Wrong answer0/621ms14708 KiB
17Wrong answer0/621ms14880 KiB