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

Автор SleepyShashwat, 3 года назад, По-английски

Good Evening Codeforces! ^_^

This round is unrated; please read this to know why.

I invite you to participate in Codeforces Round #682 (Div.2) taking place on 13.11.2020 17:35 (Московское время). The round, authored by Anti-Light and me, is rated for users rated less than 2100, while other users can participate non-competitively.

The round features six problems, and you have 2 hours to solve them. There may, or may not, be an interactive problem; regardless, you should know how to deal with them.

I would, now, like to thank–

We will announce the scoring distribution shortly. The scoring distribution is 500–750–1250–1750–2250-3000.

Good luck, and stay safe!

UPD: Editorial

For students in high school or below—

Participants who are currently in high school or below are eligible to win prizes — 25 USD gift cards to 5 random participants who solve at least 3 problems. Prizes are sponsored by Athena Education and are NOT related to Codeforces. To be eligible, please fill this form (it will be closed after the round ends). If you're interested in participating in other technical events, such as Machine Learning and Computational Linguistics, please head over to exunclan.com.

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

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

Registered Participants are eligible for the following prizes.

Registered participants on round or those who filled the form?

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

Hmm, it would have made sense if there were cash prizes for top rankers + random people, or only top rankers. But to have prizes only for random people is a bit weird.

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

Expecting a Good Problem Set. Because it's SleepyShashwat

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

Hope you weren't sleepy while writing problem statements.

»
3 года назад, # |
  Проголосовать: нравится -141 Проголосовать: не нравится

.

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

    Seems like first time we are seeing Monogon loosing contribution

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

      I'll have to find a new source of dopamine now

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

        Seems like you already found one, But sadly I have to loose some of my contributions because of above comment. Though I don't care about it(but who doesn't like green++).

        Edit:Also I can see realnimish gaining +47 because of my username, thats interesting. I think people should atleast appreciate my username, if they don't like the comments XD.

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

      Its a trap

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

      You just see he will reply to the comments like yours and get 1k upvotes.

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

intresting problems.

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

I'm currently in high school but over 2100, so this round will be unrated for me. Will I still be eligible for any prizes?

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

As a tester these problems were very interesting!

»
3 года назад, # |
  Проголосовать: нравится +98 Проголосовать: не нравится
Mandatory meme
»
3 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

[Your text to link here...](IMG_20201111_021152.jpg)

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

    I am telling you that cute little face had no idea that round would be unrated.. Though had fun first 10 minutes of rounds..

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

Finally!

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

Wow that's a whole lot of testers!

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

Now I am more excited about the 3b1b-style video editorials!!

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

lol, 1 week without contest,

It was difficult, MikeMirzayanov

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

please we request don't take 10 days gap for codeforces contest

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

These 10 days made me realise the plight of div 1 users. Guys hats off to your patience (all div 1 users)

»
3 года назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

yo 3b1b type videos? that's sick

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

Finally a contest now :)

It seems that there are much more people testing for the contest. So I think this Div.2 would be an excellent one :)

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

    Oh no, it became an unrated contest becuase of B :-(

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

    I think I would like to delete my comment :-(

    Picture below shows how I feel when I saw the announcement that the contest is unrated...

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

Finally something to cheer about

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

![ ](IMG_20201113_113829.jpg)

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

Wow, there is Anti-Light in writers too!!

I guess this round is going to be awesome.

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

Happy Diwali :)

»
3 года назад, # |
  Проголосовать: нравится -17 Проголосовать: не нравится

They say it's an Indian contest but it isn't just an Indian contest, it's an Indian_Iranian contest. Because Anti-Light is Iranian. So... it means it's gonna be so good.

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

I didn't finish the form which to prove i'm a high school student. Could I finish it now?

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

Happy Diwali Everyone !!

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

problems are very sexy 10/10 would bang

»
3 года назад, # |
  Проголосовать: нравится -23 Проголосовать: не нравится

Is it rated?

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

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

happy diwali to everyone out there

this diwali i pray to god so that your code gets compiled and accepted at one go(mine too :) ).

happy diwali happy coding

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

Every body holds his hat XD

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

registered already but showing need to register to submit

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

queue?

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

I submitted a source code before they changed N and T, and got WA for no reason, very cool.

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

what's going on. is that really unrated?

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

I don't get it

What was wrong with B?

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

    same here, i also saw the correct constraints after submitting A in 2 minutes(they said constraints were wrong for 10 minutes)

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

Got a round after so many days and that too became unrated :(

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

Friday the 13th

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

When I will tell my granchildren that we had rated contests on CodeForces, I bet they wouldn't believe me.

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

After waiting for so many days, we got unrated round... :-(

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

Why unrated? I was really fast in ABC, so sad :/

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

So sad that this is unrated! It's first time I pass the D

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

The problems are really good!

It's a pity that so many testers and no one caught the issue with constraints on B :(

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

    What was the issue? I didn't get it !! Were the constraints low or high?

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

    Too many chefs spoils the food

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

    Agree the problems were quite good could have been a great round.

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

    I don't want to say too much, but this isn't the fault of testers.

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

      It is neither author's fault nor testers'. I guess it's contestants' fault that they couldn't guess the correct Constraints.

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

        How about let's try to understand the situation better instead of making pointless sarcastic statements that no one actually implied.

        There are more people involved in contest preparation than just author and tester. Several times accidents have happened because things are changed (and sometimes, need to be changed) at last minute, when most testers have already completed their job.

        And often in real life, taking the blame isn't as easy as "it is person X's fault". There are often cases where something is shitty but no one actually really did anything wrong. Of course something has to change but it isn't as simple.

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

          Okay, sorry for that but if things are changed at the last minute, then it is better is postpone the contest and have it tested again. It's better for everyone.

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

          don't get me wrong but if the above comment was by Monogon you must have laughed and upvoted too.

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

      Maybe they don't even know if the constraints are right or not, so it is not appropriate to put the responsibility on the testers without thinking about it, I think.

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

You know . when you make round unrated half of participants are happy and half not !. im in unhappy group . also when the reason of that is just a bit change in limits!!!!

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

when u finally get <2k rank but round becomes unrated :(

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

Luckily I didn't use array with constant space in B

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

40 testers and noone used assert while testing to check the constraints??? Seriously what did all these testers do? Felling sad for the authors :(

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

    Don't you know, testers job is to ask for contributions?

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

    It's writer's job to add validator and validator tests. And coordinator's job to check if the author did it.

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

      I know, I was involved in preparing and testing many contests (Not Codeforces rounds). Usually while testing assert should added every where, to check the constraints and all other conditions.

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

Very disappointing. 3 questions inside 25 mins and on track for CM status, and then it's unrated because the constraints were wrong.

I sympathise with the writers and am grateful for the effort that is put in. How did the testers not pick this up?

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

What was the mistake(in constraints) in B ?

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

    The correct constraint is $$$2 \leq n \leq 1000$$$, but at the beginning of the contest it was $$$2 \leq n \leq 2 \times 10^5$$$. Now the constraints have been fixed.

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

      I think it is the other way. The tests where with arrays of size up to 2e5, but the statement stated n<=1000. Then they changed the statement, then the tests, then the statement again to be like it first was.

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

I am not sure what the testers are supposed to do but confirming the constraints seems like one of the first things to do. Anyways, the problems were nice. Also, I think there should be a gap between different tests in sample. Makes it a lot easier to read.

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

.

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

It's a shame the round is unrated, the problems are quite beautiful. The issue with constraints on B was not the fault of authors, so please don't downvote the blog out of anger.

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

    ok,We will downvote your comments from now on

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

      Downvote me for being supportive of the setters who had nothing to do with the cause of it being unrated? Okay, then I'm proud of those downvotes

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

        Ok I had some slightly bad information at the time I made my comment, but I still stand that people shouldn't downvote the announcement or comments before understanding how the error happened. Still just wait for an explanation of what went wrong.

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

      I don't think it's a wise move ...

      I know you're angry for the contest, yes, we are all disappointed, but no matter how the contest is, it's not the fault of these users who write their comment, I think. So it may be a better choice to delete what you say just now.

      No offense to anyone.

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

Feeling Sad for SleepyShashwat !!! Problem set were really good !!

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

(IMG_20201113_213202.jpg)

»
3 года назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

This is the first time i solved a problem with in 60 seconds i got 500 points but sadly the contest became unrated :(

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

Even though it's unrated, don't discuss the problems, please, before the end of the contest. Writer is still going to give prizes

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

One request to codeforces if round is unrated please use bold letters so we don't get a blow after a while

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

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

[Deleted]

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

B positive

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

The tasks were really very interesting.

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

When you solve 3 problems in 12 mins finally, after consecutive blows in previous contests, and the entire universe conspires to screw your rating!

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

Damn I couldn't get C but solved D and climbed to rank 18 for a moment. And now I am like bruh

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

Actually,B doesn't really need an array.

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

Thank you. I love Codeforces!

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

If you got the idea of problem B, it didn't matter the constraints. And the notification of the correction was done with plenty of time to review the problem for any player. I don't think the effect to the score would be stronger than what happens when hidden tests fail at the end of the round after pretests passed. In my opinion, the round shouldn't be unrated...

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

»
3 года назад, # |
  Проголосовать: нравится -12 Проголосовать: не нравится

came to read comment section just to be sure that It's unrated.

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

I was supposed to lose 73 points... and then the round became unrated.

Anyways, I still think it's a pity that the round is unrated because problem B was nice (even though I couldn't solve it). Based on comments, the remaining problems were also nice.

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

well i think i found solution to C but its way too hard for C and takes too long to code ... D was really easy for me on the other hand maybe im a potato :/

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

    C is easy: You just have to make the parity of a[i][j] the same as i + j.

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

    Well, you could make some elements even, and some elements odd. After actions your matrix mod 2 should look like:

    0 1 0 1
    1 0 1 0
    0 1 0 1
    1 0 1 0
    

    So the algorithm is:

    if ((i % 2) + (j % 2) % 2 && a[i][j] % 2) a[i][j]++;
    else if ((i % 2) + (j % 2) % 2 == 0 && a[i][j] % 2 == 0) a[i][j]++;
    
»
3 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

Today maybe it was my best performance , and it got unrated .In the next contest it will be rated and I will get a minus 50. Cause that's life.

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

    But it'll not change the fact that it is your best performance today isnt. Don't put a number tag on everything , life will be beautiful.

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

what is wrong with this idea for $$$D -$$$ If n is odd $$$or$$$ (n is even and there is no odd frequency element) then $$$YES$$$ else $$$NO$$$

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

What is wrong with my code(problem D) https://codeforces.com/contest/1438/submission/98320619

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

Dear division 1, the short interaction between you and me was nice. Now, we have to part away.

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

.

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

    for each i and j, ensure that inp[i][j] + i + j is even (or odd). then adjacent numbers will have opposite parity, making sure that adjacent numbers are different.

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

    Try to arrange elements like ,

    0101010
    1010101
    0101010
    

    where 0 represent an even number and 1 represent an odd number. Of course you can always change the parity of a number by adding 1 to it.

    I have seen that most of the people have done it by using dfs also.

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

Well it was Friday the 13th. Coincidence? I think not :)

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

Can someone explain how to solve problem C?

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

did you also overcomplicated solution for B or are you normal?

expected solution was if all elements are distict print "NO" else "YES".

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

So in D, I constructed solution for odd n and couldn't get the x-or = 0 thing for even n, foolishness 100. Just got it now.

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

    for n-odd i think the solution is xor between all numbers and that's all. So you just have to print 1,2,3 1,4,5 .. 1,n-1,n for n-even i think you don't have solution if : all numbers have the same bit 1 or xor between all isn't 0. WA on test 4

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

    Same thing.

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

Did anyone else use 2-SAT for C? xD

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

    twf using dfs for C

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

      Pfft, you aren't a real programmer if you don't solve 2-SAT by putting it into your own hyper-optimized (exponential but still super fast) 400-row general SAT solver.

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

Nobody did any hacking, interesting XD

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

It's okay that the round is unrated. It happens.

However, I hope the announcement would emphasize the fact that it's unrated when it's unrated. I saw only the first two sentences of the announcement, and I didn't read the rest of it because I saw that it was talking about problem B and I already passed it, so I thought there is no need for me to read it any further.

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

Can anyone explain why my dfs solution for C is giving wrong answer on pretest-2 here's my Submission.

I've tried it on some other test cases and unable to find any mistake. Can anyone help?

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

    Basically, it's possible for your code to increment the same value twice.

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

My solutions:

A
B
C
D
F
E
»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
»
3 года назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

Finally 13 th November. It's Unrated,still intrigued with some great problems....

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

Can anyone please tell me as to why this solution to B was wrong?

Link to Submission
»
3 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Never keep a contest on Friday the 13th

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

Is it unrated now?

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

We want one more rated contest in this week as this contest became unrated

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

Why this solution doesn't work 98303387, but this solution works 98327745?

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

Important test case is missing from D. I submitted what should be an incorrect solution, and later resubmitted a correct solution. However, my incorrect solution also passes.

The test case in question is where N = 4 and the answer is YES, e.g. N = 4, A = 2 2 2 2, or N = 4, A = 1 1 3 3

My incorrect code printed out "N-4" as the the number of steps, which gives an output: steps = 0, ops = 1 2 3

Clearly this is incorrect, and I corrected my code to output: steps = 1, ops = 1 2 3

However the test cases are not currently sufficient to identify this bug.

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

    I think it's checker's job to check the correctness of your output

    The checker reads the number of steps. Because it's 0, the checker doesn't read any operations and your output is correct. CMIIW

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

some please point the mistake in this Problem C solution solution_link

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

Easy solution to problem E:

Notice that if $$$a_l \oplus a_r = a_{l+1} + a_{l+2} + ... + a_{r-2} + a_{r-1}$$$ is satisfied, then $$$a_l + a_r \geq a_{l+1} + a_{l+2} + ... + a_{r-2} + a_{r-1}$$$ is also satisfied.

Assume we fix the position of the rightmost element $$$r$$$. Now let $$$l$$$ be the index of the first element to the left of $$$r$$$, so that $$$a_l + a_r \geq a_{l+1} + a_{l+2} + ... + a_{r-2} + a_{r-1}$$$. The sum of $$$a_l ... a_r$$$ is at least twice as large as the sum of $$$a_{l+1}...a_{r-1}$$$. Lets denote the sum $$$a_{l+1}...a_{r-1}$$$ by $$$x$$$. Notice that the element at the next valid left endpoint will have to be at least $$$x * 2$$$, the next one at least $$$x * 4$$$ ... Hence there are at most $$$log(maxA)$$$ candidate left endpoints for a single $$$r$$$. We can check all of these subarrays $$$O(N \cdot logN \cdot log(maxA))$$$ time using range queries or set (the solution works with a very small constant factor).

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

Hello, a newcomer here.

I was trying to use pypy3 to do F, and I got a lot of TLE's. I tried many ways to go around this, but I wasn't able to find a not-very-dodgy solution: I had to do it in "batches"

https://codeforces.com/contest/1438/submission/98332683

Is there a not-very-dodgy way to do this with pypy?

Here are some of my failed attempts: https://codeforces.com/contest/1438/submission/98331404 https://codeforces.com/contest/1438/submission/98330796

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

    I agree with this. I can't find a way to fit the solution within the time limits using pypy either.

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

can anyone explain code from jiangly

    int t;
    std::cin >> t;
    while (t--) {
        int n, m;
        std::cin >> n >> m;
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= m; ++j) {
                int a;
                std::cin >> a;
                std::cout << a + (a % 2 != (i + j) % 2) << " \n"[j == m];
            }
        }
    }

// Plz explain this line
//  std::cout << a + (a % 2 != (i + j) % 2) << " \n"[j == m];


Thank you folks.
  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    If (a % 2 != (i + j) % 2) this statement is true it will add 1 with a . And the statement means -->> a odd and (i+j) even -OR- a even and (i+j) odd.

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

      how does this syntax works << " \n"[j == m]; ?

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

        That's the equivalent of saying:

        if (j == m) cout << '\n';

        EDIT: Think of it this way:

        You are given a string of two characters ' ' and '\n', which is represented as " \n". Take the character at index [j == m]. Keep in mind that j == m yields either 1 (true) or 0 (false).

        Hope it clears it up.

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

        if j==m it will print a new line otherwise a space

»
3 года назад, # |
  Проголосовать: нравится -28 Проголосовать: не нравится

upvote this comment if you too think today's contest was mainly based on simple observations only.

[please don't downvote to pull my leg]

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

    That's the case with most Div2 rounds nowadays, which is by no means a bad thing. In fact it's only true with A, B and C problems. Give D, E and F a go and you'll be proven wrong very easily. People of all levels get 1 problem to play with, while others stay far below/above their current level and in my opinion that is very well balanced.

    Problem solving is all about logical thinking and making observations, maths and algorithms are really the tools to execute the idea.