Блог пользователя Hoks_

Автор Hoks_, история, 11 месяцев назад, По-английски

My approach is this: fix the parameter $$$x$$$ from the problem statement and forbid the largest $$$y$$$ elements from participating in any operations. In other words, after removing those $$$y$$$ largest numbers, choose the largest $$$\frac{x+1}{2}$$$ numbers among the remaining elements to contribute to the medians, then perform the allowed operations sequentially from the smallest remaining numbers toward the larger ones until you exhaust the number of operations. Let $$$f(x,y)$$$ denote the maximum sum obtainable by this strategy.

Next I conjectured that for fixed $$$y$$$, letting $$$g(x)=f(x,y)$$$, the function $$$g$$$ is unimodal. It seems to hold on small examples, but when I submitted I got Wrong answer on pretest 4.

It looks like the unimodality property was wrong, so I instead fixed $$$x$$$ and conjectured that $$$g(y)=f(x,y)$$$ is unimodal,I submitted another modified version of the code and received Wrong answer on pretest 8.

Just when I didn't know how to debug, a magical idea popped up: concatenate two implementations and take the maximum of their outputs.

That's too crazy — you know, I concatenated two approaches that were both known to be wrong, yet in fact, it actually passed the problem.

ig my method can be easily falsified, but I still want to collect hacks here — I hope some contestants can hack this code so the problem's tests get stronger.

new submission

  • Проголосовать: нравится
  • +98
  • Проголосовать: не нравится

»
11 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Hoks_ (previous revision, new revision, compare).

»
11 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I used ChatGPT to revise some of my phrasing and hope it’s easy to understand.

»
11 месяцев назад, скрыть # |
 
Проголосовать: нравится +42 Проголосовать: не нравится

Thanks to Kaey for teaching me the skill of merging two wrong solutions (it always works) :))

»
11 месяцев назад, скрыть # |
 
Проголосовать: нравится +33 Проголосовать: не нравится

Well I guess two wrongs do make a right

»
11 месяцев назад, скрыть # |
 
Проголосовать: нравится +88 Проголосовать: не нравится

Hacked

»
11 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I didn't read the problem and just injected a smarter ternary search in your first solution and it passed first try: 344834569

Which tells that this function is almost ternary, at least in existing tests.

Anyone to hack it?

»
10 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Hoks_ (previous revision, new revision, compare).