Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. Оно применяется начиная с раунда 972. ×

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

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

Hello Codeforces!

I have the pleasure of inviting you to participate in Codeforces Round 960 (Div. 2), which will start on Jul/20/2024 17:35 (Moscow time).

The problems were prepared and authored by wuhudsm.

You will be given 6 problems and 2 hours to solve, one of the problems is divided into two subtasks.

One of the problems may be interactive. So, please refer to the guide on interactive problems if you are unfamiliar with them.

I would like to thank:

Fun fact

Good luck and have fun!

Score distribution: $$$500 - 1000 - 1500 - 1750 - (2000+750) - 3000$$$

UPD:

Editorial

Congrats for the winners!

Div 2:

  1. 0101byc

  2. Psychotic_D

  3. roIandpetrean

  4. skahl15

  5. thawin.ice

Div 1+Div 2:

  1. tourist

  2. jiangly

  3. noimi

  4. Sugar_fan

  5. 0101byc

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

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

First Comment.

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

As a blue tester, my color changed two times while testing the round :)

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится -12 Проголосовать: не нравится

    as a green participant, I want you blue tester (or you) to provide me a counter test for my submission of C HERE IS THE SUBMISSION : 271641802

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

Can't wait for it!!

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

As a tester, wuhudsm orz

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

As a tester ,I believe you should definitely give this contest. All the best!!

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

thank you for letting know CHATGPT solved 0 problem!

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

As a tester, I will be missing the chance to give this contest :(
Btw, this is my first round as a tester. Hope everyone enjoy the problem set.

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

will be gr8 if can solve 3 to 4 problems this time, will try to get under 3k rank

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

In the last contest, I lost 160, and I hope to recover it.

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

As a tester, I almost accidentally registered for this round. Hope you have fun :)

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

CHATGPT for solving 0 problems : )

Lol, it would be nice if every contest is also tested on GPT to reduce the chances of cheaters using such tools

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

    Using chatgpt is not cheating

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

      Yeah that's true for debugging and stuff, but sometimes, rarely, the whole question gets solved by GPT, I've seen people in my college just copy paste the question and get an answer, still it's more common on LeetCode.

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

        its still not cheating (on cf atleast), just bad problem setting

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

          True, makes sense

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

            Tbh, I was not able to understand 136A - Presents question language and its test cases literally!! And i ask gpt to explain it to me in simple term with example without code...

            My question is- Is this a bad practice??paramveer5404

            • »
              »
              »
              »
              »
              »
              »
              2 месяца назад, # ^ |
                Проголосовать: нравится +5 Проголосовать: не нравится

              Using GPT still feels like a grey area to me. I also use it to sometimes understand the question properly or debug stupid errors like initialising an array before taking input or something like that. I have asked my seniors who are Experts and CMs,they also say that it's okay to use GPT for the above purposes but they suggest to avoid spending too much time on GPT in hopes of getting an answer.

              But one of my friend who uses a lot of GPT once got skipped in a contest(I'm certain he did not use telegram etc.), maybe coz a lot of people would use the same GPT solution leading to a Skipped.

              So I feel it's okay to get things debugged or to understand the question but copy pasting code from GPT feels risky.

              But I feel that I am not that experienced enough to conclude something.

              What are other people's thoughts on this? Anyone wants to weigh in, in the comments.

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

I'm tired of wishing too much

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

As a tester, I failed to solve any problems.

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

As a tester, I found that GCD(score distribution)=250k for k>=1.

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

As a tester, I disappeared from the scoreboard :(

»
2 месяца назад, # |
Rev. 20   Проголосовать: нравится -18 Проголосовать: не нравится

excited

»
2 месяца назад, # |
  Проголосовать: нравится -19 Проголосовать: не нравится

i would happy if codeforces avoid the contests on saturdays which actually clash with lc biweekly contest

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

im really hoping for 1434 rating this time...

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

As a tester, I did disappear from the standings.

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

As a tester, I also disappeared from the scoreboard :(

(Even hadn't finished all the problems until yesterday lol.

I love some of the problems so much and hope you enjoy!)

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

As a tester, I wasn't removed from the standings during testing.

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

As a tester, 111001110000101100011100100000011011.

»
2 месяца назад, # |
Rev. 5   Проголосовать: нравится +29 Проголосовать: не нравится

As a tester I want to give a hint for this round

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

As a tester, I highly recommend you to participate in the contest. Problems are interesting!

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

As a Pupil, do i have to know "how to solve interactive problems". As i will be trying only A and B.

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

First time tester in an official round, testing is fun.

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

SURELY... i wont spend an entire hour on C

or come up with a wrong proof on D

OR get trolled by E's problem statement

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

As a tester, wuhudsm has put a lot of effort to make sure that the problemset is balanced.

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

As a participant, I think a space is missing in the title.

Upd: fixed :)

»
2 месяца назад, # |
  Проголосовать: нравится -15 Проголосовать: не нравится

This contest timing(8 — 10) is clashing with leetcode biweekly(8 — 9:30). I am Indian (GMT + 5:30)

»
2 месяца назад, # |
Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится

As a tester, I almost disappeared from the scoreboard since all the problem I solved when testing were replaced, and only the problems I got WA are left, anyways don't miss it since lots of efforts were put, and hope you will enjoy the contest ^_^ !

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

Quite Excited For The Contest ! :)

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

As a tester, I don't know the problemset because it's different from ones I solved in testing.

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

OMG! Another wuhudsm round!

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

.

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

hoping pupil

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

How does one become a tester for such divisions? And are there any requirements?

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

As a fan of wuhudsm, I am a tester who doesn't remember when I was on scoreboard.

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

As the first palestinian tester , I tested ! I didn't disappeared from scoreboard xD as a tester

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

Yet another great wuhudsm round, I'm sure this round will be so cool.

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

As a tester, I have bipolar disorder

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

First official round testing ~.~

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

As a tester, I was last on the scoreboard of the VC

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

Is there a chance of an interactive problem in A->D ?

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

As a tester, I should test the round again.

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

as a tester, i almost forgot that the testing exists :skull:

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

"CHATGPT for solving 0 problems : ) ;"

Thank you for telling me this. =)

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

So did these testers test fully or partially?

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

hopefully I'll solve the first Problem (500)

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

As a participant, I am excited for this round because it will be my first one.

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

hope for +delta

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

poopy pants

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

I like wuhu dasima,He likes to eat red-skinned ducks.

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

omg md_nihal orz is a tester

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

I am not much of div2 contest giver but can anyone tell will i lose ratings if i don't solve any cause my ratings went down in the last div2

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

" CHATGPT for solving 0 problems : ) " It's good to increase our rating <3

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

You is clickable. Cool!

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

I think I'll become a pupil today.

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

I'm sorry, but I guess I have to unregister this contest. How should I unregister?

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится +9 Проголосовать: не нравится
    1. It is unnecessary, you can just go AFK and not submit anything, and nothing would happen. This isn't like Atcoder when you'd be rated regardless.
    2. If you insist, however, click on the registration list, click on "Friends" (to show less participants), you'd see an x-shaped icon to the right of your handle — click it to unregister.
»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

What are (rank) testing? (like newbie testing, pupil testing...)

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

I just lost hope in today's contest. I gave up after 4 wrong submissions in A.

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

Why did my E test take so long?

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

Today's contest was the most difficult among the contests of the last month.

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

WAForces

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

I will never forget this A bait.

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

infinite queue

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

ABCD SpeedForces.

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

Apparently the contest is easy for everyone but me. Expert and I only solved A...

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

    Contest is indeed easy, but I was stupid and wasted submisssions on C and D, and didn't solve E1, E2 becauze wasted much time on C, D. D is probably easier than C, but they both are easy.

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

Problem D feels like some random constructive problem from USACO bronze division, I would argue that it's even easier than C.

How to solve D like a sane person:

Also I think something happened to the balance of the round past problem D :gasp:

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

And this is why problem A is called "Submission Bait". Next time I will consider reading problem name

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

It's on me to blame (for not debugging quickly and then submitting late tbh), but what's with the queue in the last 10 minutes? Something going wrong server-side?

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    I feel your pain, I have WA on pretest 33 in E1 that I could have fixed if my previous submit at 01:57 had been evaluated within ~2 mins T_T.

    • »
      »
      »
      2 месяца назад, # ^ |
        Проголосовать: нравится +6 Проголосовать: не нравится

      Me is a bit subtle, my code was wrong local-side and I looked at the wrong piece of code to debug for 20 minutes straight T.T Rush-submitting at 1hr57min helped nothing.

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

      can you please help
      i have an idea that if somehow we can find a path from root to some leaf in which mole lies than we can apply bs to find answer but i can't find and any way to find the correct path within the query limit.
      is my idea correct.
      if yes, some hint regarding how to find correct path
      if no, ignore

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

Problem A bait is golden

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

AdhocForces.

Moreover, the differences in accepted solution in E1 and E2 is quite low, which means the different in constraint between two versions is really hard to come up with the solution separately.

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

    What's your approach on D??

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

      Try to iterate on every row from $$$1$$$ to $$$n$$$. Then, just greedily use the first operation if the number of black cells in the current row is less than or equal to $$$2$$$, otherwise we use the second operation.

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

271621595 I tried DP on D, failed on pretest 3, can anyone tell me if the DP is entirely wrong , or is there some minor error? Or if anyone has any tricky test case , that may also help. Thanks

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

    Yeah i had the same bug but managed to fix it, here is the test case:

    1
    6
    2 4 4 4 4 2
    
    • »
      »
      »
      2 месяца назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I fixed this one, and then started failing on 2nd test case ( results were given after contest was finished, due to long queue, didn't get chance to debug/ find error in 2nd test case ) .

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

    n = 6 ,

    2 4 4 4 4 2 .

    expected = 5 .

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится
    1
    6
    2 4 4 4 4 2
    

    The answer should be 5.

    The "special case" is not a special case at all, you have to consider at every row, painting the whole thing white, but also every combination of previous $$$2\times 2$$$ grid placement with your own grid placement, making your state $$$(i, d)$$$, where $$$d$$$ represents which columns the grid from the previous row covered (I personally used $$$d = 0$$$ for "no grid", and $$$0 < d <= 3$$$ for "the grid covers $$$d$$$, $$$d+1$$$")

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

C is really easy problem once simulate and see the change.

I wish I could solve early

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

    ya even i got it though time got finished and still I have to check if it gets accepted

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

Who else got bamboozled by A??

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

can anyone tell me why my greedy logic is giving wrong or which case i am missing

submission link -https://codeforces.net/contest/1990/submission/271584567

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    Your solution fell into WA here: 7 3 2.

    With your outputted array -1 1 1 -1 -1 -1 -1, $$$x = 3$$$ obviously, but $$$y = 7$$$.

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

    I had the same solution as you for over an hour before finding out what was wrong, it's definitely very tempting to think that this is the correct solution. The problem is when the initial -1's is more than the '1's in between. Ex: Input: 9 6 5 Your output: -1 -1 -1 -1 1 1 -1 -1 -1

    However, the maximum prefix is actually at i=1. So the output is unfortunately incorrect.

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

Hardest Div. 2 A I know

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

A's name is very sus

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

May anyone tell me why for the problem B, I place a[x,y] to be 1, and place -1 otherwise, is wrong?

It seems to me obvious that for this case, x and y meets the constraint.

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

    Counter test: 6 2 1

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

      Sorry, I don't see why this is wrong.

      x=2: prefix sum=2 when i=2, and maximum prefix sum=2 y=1: suffix sum=-1 when i=1, and maximum suffix sum=-1

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

      can you explain why this test is countered test case?

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

        When summing -1, and then summing 1, we probably land on, for example, -3, because there's no enough 1 to make prefix or suffix back into positive numbers. And -3, has already been in eariler prefix or suffix.

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

    consider -1 -1 -1 -1 1 1 -1 -1 -1 -1 (n=10, x=6, y=5).I too was stuck in it for a long time

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

    from y-1 to 1,puts -1,1,-1,1,... from x+1 to n,puts -1,1,-1,1,... from y to x,puts 1,1,1,1,...

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

    For 7,3,2 Your array will be -1 1 1 -1 -1 -1 -1 . But the max suffix position is 6 for this array not 2.

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

    Cause y < x. I missed this part of the statement at first as well.

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

    -1 -1 -1 1 1

    x = 5, y = 4

    pref sum at (x) = -1;

    pref sum at index 0 is also -1

    => x can not be max pref (because max pref has to be at smallest index)

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

How to solve E? Is it related to centroid?

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

    is it even possible to do it deterministically, like if the tree is a star with n nodes, then one can't uniquely locate the mole in <n-1 queries

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

    is it even possible to do it deterministically? Like if the tree is a star with n nodes, then one can't uniquely locate the mole in <n-1 queries

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

    For E1

    You can partition the tree such that each partition has fixed depth d (for some parameter d), except possibly the root partition. This can be accomplished via dfs.

    Then, you ask whether each partition contains the mole or not. If you have found one, you can basically ask queries in such a way that the mole reaches past the root of the partition (for example, one dummy query to make mole go up, and another to check if the partition still contains the mole).

    Now if you choose the parameter d appropriately, you can ask the queries < 300 times.

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

Was D really that easy ? 1.7k solves ?

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

Very hard E, although considering the score distribution that seems fair.

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

C is one hell of a problem, i was like first 10 min:Oh hell no,i wont be able to

next 20 min:Maybe I can

next 30:No i can't

next 20:oh wait ,it is an increasing sequence

next 10:WA on pt2

next 9 min:Formula corrected, got AC

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

    How'd you do it ? My approach was simulate for the first 2 iterations & all the following ones get simply right shifted by 1. But that didn't work.

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

      I did the same, made two simulations,then i was sure that frequency for each element will be atleast two,then i used some math.

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

      that works 271588535

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

        I thought the same but i cant explain. Why does running it twice work?

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

          there are 2 things that you can GUARANTEE after running it twice. - 1. The new array will be increasing. (This can be guaranteed after the first run but you cant guarantee the 2nd point after the first run)

          - 2. The new array will have frequency of every single element > 1 (except the last element which will not matter).
          

          `` Now when you can guarantee these 2 points then you if run on such an array for the third time you will clearly see that the elements just shift a single place and that continues. Hope this was clear

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

            These are the observations that leads the solution but doesn't explain why does this solution work. Maybe I'm stupid.

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

              well this is a constructive problem (acc to me), so your observations are sort of your proof , and if you can agree with the above 2 points , then clearly we guarantee to reach a pattern for every input after 2 runs , so we just find a way to calculate the answer for that pattern, like thats what i thought before coding

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

                https://codeforces.net/contest/1990/submission/271632355

                Hey can you please help with an edge case for my code. Read the comments, but couldn't figure it out.

                Thanks.

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

                  For test case

                  t=1 n = 4 a = 1,1,2,2

                  your code gives 11, expected is 13. That's because

                  1,1,2,2 gets converted to 0,1,1,2

                  till here you code works perfectly but after the 0,1,1,2 will get converted to 0,0,1,1 and then 0,0,0,1 and then 0,0,0,0 . Your code just does not take these further steps into account

    • »
      »
      »
      2 месяца назад, # ^ |
        Проголосовать: нравится +3 Проголосовать: не нравится

      Looking at your code, your solution probably overflows when you do sum += i * cntter; Notice that i and cntter are both int, so while sum may be a long long, the multiplication is not aware of this and therefore overflows. To prevent this, you can simply cast one of the varibales to a long long, so sum += (ulli)i * cntter;

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

      Maybe it's your implementation, or check if any variables were overflowing, I had the same idea and it was AC. https://codeforces.net/contest/1990/submission/271592090

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

why is my logic for C failing anyone?? 271626656 I also tried this 271597372

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

started 30 min lates,almost solved c but times up

my Code for

»
2 месяца назад, # |
  Проголосовать: нравится -20 Проголосовать: не нравится

Worst contest ever

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

WHO PUT 100 PRETESTS

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

carrot extension working for anyone?

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

Amazing problems! Thanks for the round wuhudsm and all testers!

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

For C, I simulated the operations for 2 iterations, then got the sum by prefix sums My hypothesis was after 2 operations, I would have more than 2 occurrences of each element, except maybe the last one and the array is in sorted order. Then, with each operation, just the last element gets dropped off, so I can get the sum using the prefix sum.

But apparently, this is wrong. Can someone point out what mistake I might have made?

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

How do I approach problem C?

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

Although I solved it, did not like $$$D$$$. It is just about a corner case that you get from the sample tests and then generalize it.

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

Problem B can any one help me figure out what is going wrong in my submission
271616161

thanks for the help resolved now was calculating y wrongly

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

    5 5 4 is the test case where it will fail

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

      for the case 5 5 4 let solution be -1 1 -1 1 1 max prefix sum=1 which only occur once and hence maximum prefix position is 5 max suffix sum=2 which occur 2 times for position 2 and 4 but we take maximum so maximum suffix position is 4 both values matches with x and y respectively

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

        your code is giving 0 -1 1 -1 and this is wrong as it is printing 0 before debug it out and your code will work properly

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

          I'm doing every operation from index 1 to n in the code and printing out from 1 to n so 0 won't come in the output at all I feel some edge case is missing out I'm not able to figure it out

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

    try 10 5 4

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

Fucking mole

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

why this approach is wrong for question B let the array be full of 1 then after x the remaining portion must have 1 extra (-1) as to (1) so put these negatives from x to x+countofnegatives and before y the remaining portion must have 1 extra (-1) as to (1) put these negatives from y-1 to y-1-countofnegatives

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

Worst problems, it was purely ad-hoc and case-based problems. How are such authors even allowed to write problems?

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится +2 Проголосовать: не нравится

    Yeah, nice problems start from E1, but i had no time to get there, as i was getting wa2 all the time on ABCD xd

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

Idk, why... I read E2 20 minutes before the end of the contest and realised how to solve in no time, but had not enough time to implement... To me E2 <<< D, C, B

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

how to solve F

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

It seems everyone got at least 1 Wrong answer on pretest 2 on problem A

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

    I didn't, but I solved C with 10 wa instead lol A and B went pretty smooth for me, although I saw why they could be tricky.

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

    now im feeling happy i didn't even if i spent 8 mins on A

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

Could someone share solution of problem F?

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

    Here's my solution with proven correctness (& proof of good running time by AC):

    First of all, the segment is polygonal $$$\iff$$$ the maximum element is strictly less than half of the sum. One direction of the proof is obvious; for the other one consider the following construction: first the maximum goes to the right, and then all the other segments go to the left. This construction can be transformed into a polygon by dragging the intermediate points to the top & right until the end of the curve coincides with the left end of the maximum.

    Now consider a subsegment of the array. We’ll denote the sum $$$S$$$ and the maximum element $$$mx$$$. If $$$2 \cdot mx < s$$$, the whole subsegment is polygonal. Otherwise, notice that any subsegment that contains the maximum cannont be polygonal, since the sum can only become smaller. This immediately gives a recursive algorithm: if the condition is fulfilled, stop, otherwise split and take the maximum. We can maintain the sum & maximum in a segment tree.

    However, this is not enough by itself, since on the following test this works in $$$O(n \log n)$$$ even for very large array sizes:

    1 2 1 8 1 2 1 32 1 2 1 8 1 2 1 …
    

    Here’s one thing we can do: maintain a cache of answers for segments, and stop the recursion when we see the answer in the cache. Now we need to somehow invalidate the segments after something has been updated in them. Doing it naively is very tricky (and probably involves something like dynamic merge-sort-trees), but we can do it lazily: maintain the last time of update using the same segment tree. Now when a segment is queried, compare the time when the answer was put in the cache with the time of last update, and either return, or invalidate the cache record & recurse.

    The total number of cache invalidations is $$$O(\log A)$$$ per update, since every time a new segment appears that cover the same point, at least a half of the previous sum was cut, and the first sum is $$$\leq 2A$$$. Therefore, the total deletion time is $$$O(q \log A)$$$.

    The total number of recursive calls (and considered segments) across all queries should be $$$O(n + q \log A)$$$, which gives the total time of $$$O((n + q \log A) \log N)$$$, but I see no easy way of formally proving this. If anyone has the proof, please share it!

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

What is B????

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

    Set indices from $$$y$$$ to $$$x$$$ equal to 1 and to left and right from it alternate -1 and 1, like:

                y             x
    ..., 1, -1, 1, 1, ..., 1, 1, -1, 1, ...
    
»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

very nice problemset, thanks!

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

How to solve D?

My idea: all consecutive elements that are <= 2 and all consecutive elements > 2 and <= 4 can be handled by doing the 2x2 subgrid operation, and all elements > 4 can be handled by doing the row operation.

Is my idea right?

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

Can someone tell why is this solution wrong for Problem B 3rd test case : 6 5 1

Solution : 1 1 1 1 -1 1

»
2 месяца назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

I got cooked, but I liked the problems!

I haven't solved E yet, but the problem is inherently interesting, and I will have a fun time thinking about it tomorrow

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

why my approach for problem $$$D$$$ didn't work ?

  • set $$$dp[0]$$$ = 0
  • if the current $$$a_i \le 0$$$ , then set $$$dp[i + 1] := dp[i]$$$ and continue
  • if the current $$$a_i \le 2$$$ , then set $$$dp[i + 1] := dp[i] + 1$$$ and change $$$a_{i+1}$$$ := $$$a_{i+1}$$$ — 2 and continue
  • else, set $$$dp[i + 1] := dp[i] + 1$$$
  • lastly, output $$$dp[n]$$$

I did this solution but got WA on pretest 2 :(

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    There are three ways to dye a $$$2 * 2$$$ subgrid. So u can't just minus $$$a_i$$$

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

      now I got it and realized that this case:

      3 2 4 2

      should have output 3, but my solution output 2

      I don't know how I came up with that idea !^_^

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

thanks for the great round

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

what would be the difficulty rating of C?

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

Unclear Instructions in Problem E

It seems like mole will move to its parent in each query, but

It will only move when subtree does not contains mole.

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится +23 Проголосовать: не нравится

    If the judge returns 0 and the mole is not in root node 1, the mole will move to the parent node of the node it is currently on.

    ?

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

      Technically its correct , But it could be bolded or written separately in new paragraph

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

great contest got both A and B done with 2 wrong answers on both :( but I loved the problems will try to upsolve C and D.

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

I tried to use triangular numbers for C but I got WA from Test Case 2. Thoughts? 271632012

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

Solved ABC in 21 minutes,then my brain just gave up.

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

I might reach green for the first time in my life after giving contests for 11 months!!! Ngl problems were really scary Edit: Guys I did it!!!!!!!

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

Thanks for the round, the challenges were enjoyable!

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

thank you for the great problemset! :]

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

I guess my skipped solution for problem D is hackable but it passed as I missed a small edgecase

271631440

May be the testcases are not too strong

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

can someone explain problem b to me ? if i understood the problem correctlr why i don't make array all by one?

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

    Yeah, I didn't understand b as well(especially the max function)

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

    I don't really get your saying — if the array is $$$1$$$-only then $$$x = n$$$ and $$$y = 1$$$. Can you clarify your concern?

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

      I meant that I didn't understand what "maxmj=1(b1+…+bj)" and "maxmj=1(bj+…+bm)" meant in the statement.

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

        Take an array like this $$$[-1, 1, 1, -1, -1, -1, -1]$$$ ($$$n = 7$$$).

        We see that:

        $$$max_{j=1}^m (b_1 + \ldots + b_j) = max(b_1, b_1 + b_2, \ldots + (b_1 + b_2 + \ldots + b_j)) = max(-1, 0, 1, 0, -1, -2, -3, -4) = 1$$$

        Here $$$1 = -1 + 1 + 1$$$, hence the maximum prefix position of $$$b$$$ is $$$x = 3$$$.

        Similarly:

        $$$max_{j=1}^m (b_1 + \ldots + b_j) = max((b_j + \ldots + b_m), (b_{j+1} + \ldots + b_m), \ldots + b_m) = max(-3, -2, -3, -4, -3, -2, -1) = -1$$$

        With this, the maximum suffix position of $$$b$$$ is $$$y = 7$$$ ($$$b_7 = 1$$$).

        • »
          »
          »
          »
          »
          2 месяца назад, # ^ |
            Проголосовать: нравится +8 Проголосовать: не нравится

          Got it. I was thinking something similar during the contest but didn't want to write a solution in case my interpretation was wrong. Thank you for your explanation!

    • »
      »
      »
      2 месяца назад, # ^ |
        Проголосовать: нравится +8 Проголосовать: не нравится

      I used to get it wrong but now I understand the issue thank you

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

can someone tell me where this code is going wrong for Question C 271621163

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

    I think the first loop should be execute once again. The array will be incresing after the first time, and every element except for the last one will occur at least twice after the second time. Then the prefix works. I hope you find it useful.

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

Hi can someone explain why the answer is 3 for problem D
Input 3 1 3 1

--- Understood

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

Hey, does anyone know why my submission 271585746 fails for problem 1990B - Array Craft? I got told "wrong answer position is wrong!" on case 11 for the second test. Apparently my program fails on the input n=5, x=2 and y=1 for which my program outputted 1 1 -1 -1 -1. To me this seems right, but am I missing something?

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

    You are getting value -1 when you are taking the maximum suffix position as 1. You are also getting the value -1 when y = 5. The problem states that the maximum suffix position of b is the largest index i that satisfies the condition.

    So your answer is correct for the case n = 5, x = 2 and y = 5. (Not a valid case since x > y)

    For n=5, x = 2 and y = 1, the correct output would be 1 1 -1 1 -1.

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

My uncle <3 skahl15

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

After staying at a level for a long time in this game,i cleared it and more than satisfaction i feel fired up to reach the next one too.Lets goo

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

Thanks for the round, the problems are awesome!

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

I'm curious about if the definition of a[i] in D turned into column instead of row, is the problem solvable?

I misread it in the contest ╥﹏╥

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

0101byc is Fake I'd of Enucai — you can check that into his submission 271575788.

so you should declare Psychotic_D as winner (#1) of official Codeforces Round 960 (Div. 2).

not concerned with just rating, but it will be a great Achievement for Psychotic_D.

:)

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

    Hey wuhudsm I also think that users 0101byc and Enucai have some explaining to do. Additionally, please consider adopting the "trusted participants" policy from Div3 and Div4 rounds in Div2 and Edu.

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

    buddy thats not proof that the code is by them

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится +2 Проголосовать: не нравится

    Looks like it's not the first smurf account for him. The same happened in another div.2 contest. At least those two accounts are owned by the same person. After checking the code styles and templates it looks extremely similar to Enucai. But this account itself looks like a smurf account, to be honest.

    Also, Psychotic_D is also a cheater and should be permanently banned along with his friend wuhudsm and other people from their group (e.g. EndlessDreams).

    I wonder if Codeforces administration will take any action against people who cheat so much so they take top-3 in the recent rounds.

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

Wild fact: initially Problem D was placed in B and I thought it was best suitable for that position because of my greedy solution

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

seems good to be a winner XD

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

I liked the tasks, it's a pity that I couldn't take part in the contest:((

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

Thank you a lot,I got my best rank 170!

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

In Problem C why Solution is Trival and why in two operation we get the good array i.e. Non-decreasing array why this...can anyone explain me this please provide me test case