wuhudsm's blog

By wuhudsm, history, 22 months ago, In English

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. bossmeister9314

  4. skahl15

  5. thawin.ice

Div 1+Div 2:

  1. tourist

  2. jiangly

  3. noimi

  4. Sugar_fan

  5. 0101byc

  • Vote: I like it
  • +575
  • Vote: I do not like it

| Write comment?
»
22 months ago, hide # |
 
Vote: I like it +34 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +20 Vote: I do not like it

Can't wait for it!!

»
22 months ago, hide # |
 
Vote: I like it +37 Vote: I do not like it

As a tester, wuhudsm orz

»
22 months ago, hide # |
 
Vote: I like it +26 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +81 Vote: I do not like it

thank you for letting know CHATGPT solved 0 problem!

»
22 months ago, hide # |
 
Vote: I like it +36 Vote: I do not like it

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.

»
22 months ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +30 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Using chatgpt is not cheating

    • »
      »
      »
      22 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      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.

      • »
        »
        »
        »
        22 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

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

        • »
          »
          »
          »
          »
          22 months ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          True, makes sense

          • »
            »
            »
            »
            »
            »
            22 months ago, hide # ^ |
             
            Vote: I like it 0 Vote: I do not like it

            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

            • »
              »
              »
              »
              »
              »
              »
              22 months ago, hide # ^ |
               
              Vote: I like it +5 Vote: I do not like it

              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.

»
22 months ago, hide # |
 
Vote: I like it +21 Vote: I do not like it

I'm tired of wishing too much

»
22 months ago, hide # |
 
Vote: I like it +33 Vote: I do not like it

As a tester, I failed to solve any problems.

»
22 months ago, hide # |
 
Vote: I like it +24 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +62 Vote: I do not like it

As a tester, I disappeared from the scoreboard :(

»
22 months ago, hide # |
 
Vote: I like it -19 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

im really hoping for 1434 rating this time...

»
22 months ago, hide # |
Rev. 2  
Vote: I like it +30 Vote: I do not like it

As a tester, I did disappear from the standings.

»
22 months ago, hide # |
Rev. 2  
Vote: I like it +33 Vote: I do not like it

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!)

»
22 months ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

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

»
22 months ago, hide # |
Rev. 2  
Vote: I like it +25 Vote: I do not like it

As a tester, 111001110000101100011100100000011011.

»
22 months ago, hide # |
Rev. 5  
Vote: I like it +29 Vote: I do not like it

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

hint
»
22 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +18 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +53 Vote: I do not like it

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

»
22 months ago, hide # |
Rev. 2  
Vote: I like it +6 Vote: I do not like it

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

Upd: fixed :)

»
22 months ago, hide # |
 
Vote: I like it -15 Vote: I do not like it

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

»
22 months ago, hide # |
Rev. 3  
Vote: I like it +1 Vote: I do not like it

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 ^_^ !

»
22 months ago, hide # |
 
Vote: I like it +22 Vote: I do not like it

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

»
22 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

.

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it
»
22 months ago, hide # |
Rev. 3  
Vote: I like it +8 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +30 Vote: I do not like it

As a tester, I should test the round again.

»
22 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

"CHATGPT for solving 0 problems : ) ;"

Thank you for telling me this. =)

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hopefully I'll solve the first Problem (500)

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hope for +delta

»
22 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

omg md_nihal orz is a tester

»
22 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

You is clickable. Cool!

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I think I'll become a pupil today.

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it +9 Vote: I do not like it
    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.
»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Why did my E test take so long?

»
22 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

WAForces

»
22 months ago, hide # |
 
Vote: I like it +12 Vote: I do not like it

I will never forget this A bait.

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

infinite queue

»
22 months ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

ABCD SpeedForces.

»
22 months ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    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.

»
22 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

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:

»
22 months ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

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

»
22 months ago, hide # |
Rev. 2  
Vote: I like it +6 Vote: I do not like it

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?

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it +8 Vote: I do not like it

    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.

    • »
      »
      »
      22 months ago, hide # ^ |
       
      Vote: I like it +6 Vote: I do not like it

      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.

    • »
      »
      »
      22 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      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

»
22 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

Problem A bait is golden

»
22 months ago, hide # |
 
Vote: I like it +13 Vote: I do not like it

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.

»
22 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

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

    1
    6
    2 4 4 4 4 2
    
    • »
      »
      »
      22 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      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 ) .

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    n = 6 ,

    2 4 4 4 4 2 .

    expected = 5 .

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it
    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 \lt d \lt = 3$$$ for "the grid covers $$$d$$$, $$$d+1$$$")

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

I wish I could solve early

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Who else got bamboozled by A??

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

submission link -https://mirror.codeforces.com/contest/1990/submission/271584567

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    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$$$.

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    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.

»
22 months ago, hide # |
 
Vote: I like it +24 Vote: I do not like it

Hardest Div. 2 A I know

»
22 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

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.

»
22 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

How to solve E? Is it related to centroid?

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    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

  • »
    »
    22 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it 0 Vote: I do not like it

    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.

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Was D really that easy ? 1.7k solves ?

»
22 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    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.

    • »
      »
      »
      22 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      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.

    • »
      »
      »
      22 months ago, hide # ^ |
      Rev. 3  
      Vote: I like it 0 Vote: I do not like it

      that works 271588535

      • »
        »
        »
        »
        22 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

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

        • »
          »
          »
          »
          »
          22 months ago, hide # ^ |
          Rev. 5  
          Vote: I like it 0 Vote: I do not like it

          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

          • »
            »
            »
            »
            »
            »
            22 months ago, hide # ^ |
             
            Vote: I like it 0 Vote: I do not like it

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

            • »
              »
              »
              »
              »
              »
              »
              22 months ago, hide # ^ |
               
              Vote: I like it 0 Vote: I do not like it

              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

              • »
                »
                »
                »
                »
                »
                »
                »
                22 months ago, hide # ^ |
                 
                Vote: I like it 0 Vote: I do not like it

                https://mirror.codeforces.com/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.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  22 months ago, hide # ^ |
                   
                  Vote: I like it 0 Vote: I do not like it

                  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

    • »
      »
      »
      22 months ago, hide # ^ |
       
      Vote: I like it +3 Vote: I do not like it

      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;

    • »
      »
      »
      22 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it -20 Vote: I do not like it

Worst contest ever

»
22 months ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

WHO PUT 100 PRETESTS

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

carrot extension working for anyone?

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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?

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Maybe you have errors in calculation, otherwise your deduction is same as mine.

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How do I approach problem C?

»
22 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

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.

»
22 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Fucking mole

»
22 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    try the test 10 5 4 and calculate the prefix/suffix sum. The trick of B is if you put too many -1, the max pos of suf/prefix wont be at x or y

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it +2 Vote: I do not like it

    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

»
22 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

how to solve F

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +29 Vote: I do not like it

Could someone share solution of problem F?

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it +11 Vote: I do not like it

    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 \lt 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!

»
22 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

What is B????

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

very nice problemset, thanks!

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

Solution : 1 1 1 1 -1 1

»
22 months ago, hide # |
 
Vote: I like it -9 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 :(

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

thanks for the great round

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

what would be the difficulty rating of C?

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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.

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it +23 Vote: I do not like it

    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.

    ?

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
Rev. 2  
Vote: I like it +10 Vote: I do not like it

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!!!!!!!

»
22 months ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

Thanks for the round, the challenges were enjoyable!

»
22 months ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

thank you for the great problemset! :]

»
22 months ago, hide # |
Rev. 3  
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      22 months ago, hide # ^ |
      Rev. 2  
      Vote: I like it 0 Vote: I do not like it

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

      • »
        »
        »
        »
        22 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        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$$$).

        • »
          »
          »
          »
          »
          22 months ago, hide # ^ |
           
          Vote: I like it +8 Vote: I do not like it

          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!

    • »
      »
      »
      22 months ago, hide # ^ |
       
      Vote: I like it +8 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    22 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    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.

»
22 months ago, hide # |
Rev. 2  
Vote: I like it +1 Vote: I do not like it

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

--- Understood

»
22 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

My uncle <3 skahl15

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Thanks for the round, the problems are awesome!

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 ╥﹏╥

»
22 months ago, hide # |
Rev. 2  
Vote: I like it +21 Vote: I do not like it

0101byc is Fake I'd of NeverLand — 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.

:)

»
22 months ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

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

»
22 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

seems good to be a winner XD

»
22 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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