wuhudsm's blog

By wuhudsm, history, 4 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. roIandpetrean

  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

»
4 months ago, # |
Rev. 2   Vote: I like it -25 Vote: I do not like it

First Comment.

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

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

  • »
    »
    4 months ago, # ^ |
      Vote: I like it -12 Vote: I do not like it

    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

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

Can't wait for it!!

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

As a tester, wuhudsm orz

»
4 months ago, # |
  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!!

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

thank you for letting know CHATGPT solved 0 problem!

»
4 months ago, # |
  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.

»
4 months ago, # |
  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

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

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

»
4 months ago, # |
  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 :)

»
4 months ago, # |
  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

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

    Using chatgpt is not cheating

    • »
      »
      »
      4 months ago, # ^ |
        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.

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

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

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

          True, makes sense

          • »
            »
            »
            »
            »
            »
            4 months ago, # ^ |
              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

            • »
              »
              »
              »
              »
              »
              »
              4 months ago, # ^ |
                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.

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

I'm tired of wishing too much

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

As a tester, I failed to solve any problems.

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

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

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

As a tester, I disappeared from the scoreboard :(

»
4 months ago, # |
Rev. 20   Vote: I like it -18 Vote: I do not like it

excited

»
4 months ago, # |
  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

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

im really hoping for 1434 rating this time...

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

As a tester, I did disappear from the standings.

»
4 months ago, # |
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!)

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

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

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

As a tester, 111001110000101100011100100000011011.

»
4 months ago, # |
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
»
4 months ago, # |
  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!

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

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

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

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

»
4 months ago, # |
  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

»
4 months ago, # |
  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.

»
4 months ago, # |
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 :)

»
4 months ago, # |
  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)

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +7 Vote: I do not like it

    just ditch Cheatcode man they always unrate the Contest rather than catching Cheaters

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it +7 Vote: I do not like it

      True I just started LeetCode only to see 2 out of 3 contests unrated!! They don't value our time,this site much better

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

    CF starts at 8:05 and Leetcode ends at 8:03

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

      so solving 3 in 3 minutes?

      • »
        »
        »
        »
        4 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        No
  • »
    »
    4 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    What about participate in both contest:)

»
4 months ago, # |
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 ^_^ !

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

Quite Excited For The Contest ! :)

»
4 months ago, # |
  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.

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

OMG! Another wuhudsm round!

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

.

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

hoping pupil

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

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

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it
»
4 months ago, # |
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.

»
4 months ago, # |
Rev. 2   Vote: I like it -13 Vote: I do not like it

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

»
4 months ago, # |
  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.

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

As a tester, I have bipolar disorder

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

First official round testing ~.~

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

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

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

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

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

As a tester, I should test the round again.

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

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

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

"CHATGPT for solving 0 problems : ) ;"

Thank you for telling me this. =)

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

So did these testers test fully or partially?

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

hopefully I'll solve the first Problem (500)

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

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

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

hope for +delta

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

poopy pants

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

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

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

omg md_nihal orz is a tester

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

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

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

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

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

You is clickable. Cool!

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

I think I'll become a pupil today.

»
4 months ago, # |
  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?

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

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

»
4 months ago, # |
  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.

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

Why did my E test take so long?

»
4 months ago, # |
  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.

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

WAForces

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

I will never forget this A bait.

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

    true that A bait was really strong and we all fell for that bait

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

infinite queue

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

ABCD SpeedForces.

»
4 months ago, # |
  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...

  • »
    »
    4 months ago, # ^ |
      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.

»
4 months ago, # |
  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:

»
4 months ago, # |
  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

»
4 months ago, # |
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?

  • »
    »
    4 months ago, # ^ |
      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.

    • »
      »
      »
      4 months ago, # ^ |
        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.

    • »
      »
      »
      4 months ago, # ^ |
        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

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

Problem A bait is golden

»
4 months ago, # |
  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.

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

    What's your approach on D??

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

      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.

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

        Why everything makes sense after the contest :sed:

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

        lol, I definitely overkilled the problem then by doing bitmask dp for $$$a_i \leq 4$$$

»
4 months ago, # |
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

  • »
    »
    4 months ago, # ^ |
      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
    
    • »
      »
      »
      4 months ago, # ^ |
        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 ) .

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

    n = 6 ,

    2 4 4 4 4 2 .

    expected = 5 .

  • »
    »
    4 months ago, # ^ |
      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 < d <= 3$$$ for "the grid covers $$$d$$$, $$$d+1$$$")

»
4 months ago, # |
  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

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

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

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

Who else got bamboozled by A??

»
4 months ago, # |
  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://codeforces.net/contest/1990/submission/271584567

  • »
    »
    4 months ago, # ^ |
      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$$$.

  • »
    »
    4 months ago, # ^ |
      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.

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

Hardest Div. 2 A I know

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

A's name is very sus

»
4 months ago, # |
  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.

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

    Counter test: 6 2 1

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

      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

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

      can you explain why this test is countered test case?

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

        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.

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

    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

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

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

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

    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.

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

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

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

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

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

How to solve E? Is it related to centroid?

  • »
    »
    4 months ago, # ^ |
      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

  • »
    »
    4 months ago, # ^ |
      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

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

      Yes, because the mole moves up when it isn't in your subtree

  • »
    »
    4 months ago, # ^ |
    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.

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

Was D really that easy ? 1.7k solves ?

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

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

»
4 months ago, # |
  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

  • »
    »
    4 months ago, # ^ |
      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.

    • »
      »
      »
      4 months ago, # ^ |
        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.

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

      that works 271588535

      • »
        »
        »
        »
        4 months ago, # ^ |
          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?

        • »
          »
          »
          »
          »
          4 months ago, # ^ |
          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

          • »
            »
            »
            »
            »
            »
            4 months ago, # ^ |
              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.

            • »
              »
              »
              »
              »
              »
              »
              4 months ago, # ^ |
                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

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

                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.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 months ago, # ^ |
                    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

    • »
      »
      »
      4 months ago, # ^ |
        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;

    • »
      »
      »
      4 months ago, # ^ |
        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://codeforces.net/contest/1990/submission/271592090

»
4 months ago, # |
  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

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

started 30 min lates,almost solved c but times up

my Code for

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

Worst contest ever

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

    but for me i was 30min late and C was solved 90 percent, but i could have solved A,B,C earlier and got under 3k

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

    Got this hit hard... really a tough nut.

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

    maybe a skill issue? cuz the contest was nice

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

WHO PUT 100 PRETESTS

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +16 Vote: I do not like it

    The team was having fun while preparing the contest

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

carrot extension working for anyone?

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

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

»
4 months ago, # |
  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?

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

    No that's absolutely correct that what i have done Maybe there is some other issue

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

      okay then I might have made some error in the implementation. Thanks!

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

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

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

    You might have used int instead of long long -- that's the mistake I made...

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

      Yes that's exactly what I missed. I was using #define int long long, but forgot to use LL in accumulate(). :(

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

How do I approach problem C?

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

    Read the comment above

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

    Try to apply the operation for about $$$3$$$ or $$$4$$$ times to an arbitrarily varied array, and you'll get a pattern that you could collapse neatly with a bit of maths.

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

      i think only 2 is enough right?

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

        Coding-wise, yeah. But to observe the pattern, I think applying with pen and paper for one or two more doesn't harm.

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

          thats true :)

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

          can you tell me why my submission gave WA on pretest 2:271641802, could you give me a test case for this problem, a hard one

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

    print a table

»
4 months ago, # |
  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.

»
4 months ago, # |
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

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

    5 5 4 is the test case where it will fail

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

      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

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

        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

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

          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

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

    try 10 5 4

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

Fucking mole

»
4 months ago, # |
  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

  • »
    »
    4 months ago, # ^ |
      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

»
4 months ago, # |
  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?

  • »
    »
    4 months ago, # ^ |
      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

»
4 months ago, # |
  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

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

how to solve F

  • »
    »
    4 months ago, # ^ |
    Rev. 2   Vote: I like it -12 Vote: I do not like it

    Please somebody ban this guy... inappropriate name for the website.

    Akulyat

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it -19 Vote: I do not like it

      it's none of your business

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

        Keeping CF clean and sacred is everyone's duty. I am just fulfilling mine.

        Either get ban, or don't comment on public form with such an inappropriate user-names.

        As simple as that.

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

      chill, bro just wanna solve F.

»
4 months ago, # |
  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

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

    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.

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

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

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

Could someone share solution of problem F?

  • »
    »
    4 months ago, # ^ |
      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 < 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!

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

What is B????

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

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

      what if fill y to x with 1 and to left and right of it fill only -1

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

        doesn't work. For example,

        8 6 5
        -1 -1 -1 -1 1 1 -1 -1
        

        Cuz best prefix is $$$2$$$

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

very nice problemset, thanks!

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

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?

»
4 months ago, # |
  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

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

    best prefix is $$$4$$$ not $$$5$$$

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

    max prefix is at position 4 or 6, not 5

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

    sum from 1 to 5 is not the maximum prefix sum.

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

    for the solution you have written maximum prefix position will be at 4 i.e in the question x=5 one of the solution is 1 1 1 1 1 -1

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

    the best prefix of your solution is 4, but the prefix at index 5 is 3

    this will work: 1 1 1 1 1 -1

»
4 months ago, # |
  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

»
4 months ago, # |
  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 :(

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

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

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

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

      • »
        »
        »
        »
        4 months ago, # ^ |
        Rev. 2   Vote: I like it +1 Vote: I do not like it

        Your idea isn’t totally wrong though, more dp states might help :).

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

thanks for the great round

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

what would be the difficulty rating of C?

»
4 months ago, # |
  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.

  • »
    »
    4 months ago, # ^ |
      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.

    ?

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

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

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

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.

»
4 months ago, # |
  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

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

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

»
4 months ago, # |
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!!!!!!!

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

Thanks for the round, the challenges were enjoyable!

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

thank you for the great problemset! :]

»
4 months ago, # |
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

»
4 months ago, # |
  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?

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

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

  • »
    »
    4 months ago, # ^ |
      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?

    • »
      »
      »
      4 months ago, # ^ |
      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.

      • »
        »
        »
        »
        4 months ago, # ^ |
          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$$$).

        • »
          »
          »
          »
          »
          4 months ago, # ^ |
            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!

    • »
      »
      »
      4 months ago, # ^ |
        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

»
4 months ago, # |
  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

  • »
    »
    4 months ago, # ^ |
      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.

»
4 months ago, # |
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

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

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?

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

    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.

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

My uncle <3 skahl15

»
4 months ago, # |
  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

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

Thanks for the round, the problems are awesome!

»
4 months ago, # |
  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 ╥﹏╥

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

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.

:)

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

    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.

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

    buddy thats not proof that the code is by them

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

    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.

»
4 months ago, # |
  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

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

seems good to be a winner XD

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

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

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

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

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

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