127.0.0.1's blog

By 127.0.0.1, history, 3 years ago, translation, In English

Hello, Codeforces!

max0000561, a.nasretdinov and I are glad to invite you to our Codeforces Round 907 (Div. 2), which will be held on Oct/30/2023 17:35 (Moscow time). The round will be rated for all the participants with rating strictly less than 2100.

On behalf of our team, I want to thank:

And special thanks to my friends who have made a huge contribution to this round: Amir a.nasretdinov Nasretdinov, Maksim max0000561 Krylykov and Tanya medved Medved. Also thank you for all four years of friendship:)

During the round you will need to solve 6 problems. You will have 2 hours to solve them.

Score distribution: $$$500-750-1000-1500-2000-2250$$$

Good luck and, please, read the statements of all problems!

UPD: Editorial is out.

UPD 2: Congratulations to the winners!

Div. 1:

Div. 2:

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

| Write comment?
»
3 years ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

Can't believe that mine is the first comment!

»
3 years ago, hide # |
 
Vote: I like it +29 Vote: I do not like it

Wow, So exciting to see this round, I hope it will be interesting.

»
3 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I hope I can reach Specialist.

»
2 years ago, hide # |
 
Vote: I like it +15 Vote: I do not like it

As a tester, the problems are cool and interesting!

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Score distribution .... Whoa ......

»
2 years ago, hide # |
 
Vote: I like it +15 Vote: I do not like it

Point distribution suggests all problems could be solved by average Div-2. But history suggests, Point distributions can be deceiving ... :D

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Good luck and, please, read the statements of all problems!

Is there anything implied in this sentence?

»
2 years ago, hide # |
 
Vote: I like it +13 Vote: I do not like it

as a friend of the author of the round, I predict that round will be great!

»
2 years ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

Message Notification system in telegram is very pleasurable for me . I almost forgot about this contest but telegram notification alerted me timely . Thanks to codeforces management system.

»
2 years ago, hide # |
 
Vote: I like it +161 Vote: I do not like it

Kudos to 74TrAkToR for his decision about placing problem F at Div. 2 F!

He is the only coordinator who will make such creative decision!

»
2 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Are you sure E and F should be in that order?

»
2 years ago, hide # |
 
Vote: I like it +43 Vote: I do not like it

Good luck and, please, read the statements of all problems!

Lol, they knew F was easier than E

»
2 years ago, hide # |
 
Vote: I like it +29 Vote: I do not like it

What was the idea of setting $$$1$$$sec TL in $$$D$$$???

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

    982 ms

    Clutched it

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

      Yes! I really don't understand why you should put a $$$1$$$ second limit, it makes it very hard to pass a python problem or a completely unoptimized $$$O(nlog(n))$$$ solution in $$$C$$$++. It's just an idiotic decision to put such a limit from the author! On the other hand the task is cool.

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

    That is probably because you are expected to precompute something?

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

In problem D, how to optimize it from q*60*60?

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

    You can do $$$O(q*60)$$$ by storing each consecutive range with the same values, and iterating through this range vector for final computation.

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

    f(x) ranges from 2 to 60 and for each f(x), g(x) is monotonic. Also for each f(x) if you check g(x) can have atmax 2 values. Precompute for all such ranges and answer it. tc: q*70 ig

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

      Yeaa!

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

      For each f(x), g(x) is monotonic. But how can we say that for each f(x), g(x) can have at max 2 values?

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

        What i did was just printed the g(x) value for start and end point for each f(x), i.e. 2^i, 2^(i+1)-1 and it turned out the difference between them is atmax 1. and since it is monotonic u can find the point where it changes using binary search.

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

        $$$x$$$ just almost doubles in this range

        For the function to take more than 2 integral values, we need X to be multiplied by $$$floor(\log_2 x)$$$ which is more than 2

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

        Hello sir . did u unnderstand why atmax only 2 values can be present. if so could u pls expalin sir

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

          Consider the range $$$[2^x, 2^{x+1}-1]$$$.Let y = f(x) >= 2. For some k, $$$y^k$$$ is somewhere between $$$2^x$$$ and $$$2^{x+1}-1$$$. So, $$$y^k \ge 2^x$$$. Then $$$y^{k+1} = y(y^k) \ge y(2^x) \ge 2^{x+1}$$$

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

      At first, I thought g(x) is monotonic on the whole range (not depend on f(x)), which give me wrong answer in the sample test case :((. Sad to be unable to solve D.

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

In my opinion, F is easier than C. I was stuck on C the whole contest, but figured out F 15 mins after seeing it.

Drop CM again :(

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

    Was F using dynamic segment tree?

    • »
      »
      »
      2 years ago, hide # ^ |
      Rev. 3  
      Vote: I like it +3 Vote: I do not like it

      I used BIT, but I think segment tree works too.

    • »
      »
      »
      2 years ago, hide # ^ |
      Rev. 2  
      Vote: I like it +20 Vote: I do not like it

      Another solution for $$$F$$$ without reversing queries!

      When you add $$$x$$$ to all values in subtree of node $$$i$$$, just add $$$x$$$ to $$$val[i]$$$. The answer for every node $$$j$$$ is the sum of $$$val[k]$$$ such that $$$k$$$ is ancestor of $$$j$$$ (Call this sum as $$$S(j)$$$)

      However, when you add node $$$t$$$ to the tree, then add node $$$t$$$ with $$$val[t]$$$ = $$$-S(t)$$$ in the current state of tree. This will "undo" the contribution of subtree sum addition due to queries performed before addition of node $$$t$$$.

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

        But how can we calculate -S(t) fast before adding node?

        • »
          »
          »
          »
          »
          2 years ago, hide # ^ |
          Rev. 2  
          Vote: I like it +3 Vote: I do not like it

          Using a fenwick or segment tree. Adding $$$x$$$ to $$$val[i]$$$ means, add $$$x$$$ at $$$tree[tin[i]]$$$ and $$$-x$$$ at $$$tree[tout[i]]$$$. Note that $$$tin[i],tout[i]$$$ represent in-time and out-time of node $$$i$$$ respectively. Query sum of range $$$[1..tin[i]]$$$ to get $$$S(i)$$$.

»
2 years ago, hide # |
 
Vote: I like it +51 Vote: I do not like it
»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Thanks for the great round

»
2 years ago, hide # |
 
Vote: I like it +60 Vote: I do not like it

2^Forces

»
2 years ago, hide # |
 
Vote: I like it -19 Vote: I do not like it

I don't believe that task E can be simpler than F

»
2 years ago, hide # |
 
Vote: I like it +116 Vote: I do not like it

Thanks for the round! I enjoyed the problems, but F is absurdly misplaced. I spent less time on it than on any problem after B, and if it had appeared in position D I would not have thought anything was out of the ordinary; indeed, F had nearly as many solves as problem D did. (I also think F is a bit on the standard end, but it's fine for a Div. 2 only round.)

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

FForces

»
2 years ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

read the statements of all problems!

This means you should look at the leaderboard to decide on which problem to work on.

»
2 years ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

What can so many people solve F! i couldn't get any valid ideas.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

wow system testing already ??

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

What is the 35th pretest?

»
2 years ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

good contest

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it
»
2 years ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

Thank you for the beautiful round, loved it, although stuck on first problem till the end of time. Need some skills

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

D Problem, For 179 1000000000000000000 of sample testcase, I get 41949982 in my system and online IDEs, but I got 773751787 codeforces, What had gone wrong ? where should I look for ? my submission

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

    I think overflow on signed integers is undefined behaviour, so that's why it's giving different results as your overflow check will not be correct. I don't know how to escape the overflow other than to tediously change everything to int_128 or do the code in python(risk of TLE).

»
2 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

In F, the pretests were passed, but now I got MLE on test 16. The pretests were more than 16, so shouldn't it be tested in the pretests?

»
2 years ago, hide # |
 
Vote: I like it -23 Vote: I do not like it

Like really bro? F is way too easy for being the last problem of this contest.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Isn't the range of unsigned long long till 2^128-1? In my local, it was overflowing on 2^70 only. Why?

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

B can be cheesed, bad testcases i guess Link

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

230580209 can anyone try to help me finding bug in solution for D?

»
2 years ago, hide # |
 
Vote: I like it +41 Vote: I do not like it

A round where everybody solved F.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

B is kind of tricky, should some tricks.

»
2 years ago, hide # |
 
Vote: I like it +5 Vote: I do not like it
Relevant intervals for D
»
2 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

I guess D is all about implementation

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

When do the ratings get updated? Thank you.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Why are today's editorials so late?

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

May I know why my 230532327 to B is skipped? 127.0.0.1

  • »
    »
    2 years ago, hide # ^ |
    Rev. 2  
    Vote: I like it +7 Vote: I do not like it

    Only the last "passed pretest" submission would be run in system test.

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

    it's because when you submit multiple correct solutions of a problem during contest, all the other accepted submissions (except the last one) of that particular porblem automatically get skipped.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

My $$$O(Q*64)$$$ solution is doing TLE on test-case 10 https://mirror.codeforces.com/contest/1891/submission/230585018

my basic idea is between [2^q, 2^(q+1)], g(k) can only take atmost two possible values and I am combining them. Corner segments are handled separately.

Can I optimise it further or is it just too slow fundamentally, within the constraints I reckon it'd pass all the cases

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

What is the deal with pretest 8 problem D? For 63 5153632, my code gives 20673255 whereas the answer is 20673256. I can't figure out how I'm missing the extra 1! Any ideas?

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How to solve B?

»
2 years ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

Problems were really good!!

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

When will the editorial be? Or maybe I'm missing something? Thanks

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

why approach for F with euler tour + lazy prop is giving tle on tc 22. code- https://mirror.codeforces.com/contest/1891/submission/230589277

any help will be appreciated..

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

conragts to Gwynbleidd_ for finally reaching CM ( ME )

»
2 years ago, hide # |
 
Vote: I like it +30 Vote: I do not like it

just wanted to see how this new color looks in comments

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

Hey, is it okay to check long long overflow using long double? I mean this :-

long double val = a;
val *= b;
bool overflow = val > LLONG_MAX;

Does anyone have experience with this? Even if it is not precise, can you get away with it during contests?

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

    I mean one scenario where this might come handy would be say you want to calculate log(1e18, 60) using a for loop. You loop through 1 to 10 and it's all <= 1e18 so you would want to check for 11, but that is where it overflows. But the above trick works here ig.

»
2 years ago, hide # |
Rev. 2  
Vote: I like it +125 Vote: I do not like it

I don't think that ETO is an individual participant. The submissions from that account is suspicious.

Its code style in Problem A and Problem B matched. However, a new default source came up in Problem C and Problem D with different reading and multi-test handling method. The last two submissions are even more confusing.

Among these submissions, we can learn 4 ways to solve a multi-test problem, 3 ways to read a integer from stdin, 3 ways to set a constant value, which is shocking. It's easy to see that there are >1 members(possibly 4: AB+CD+E+F) so they should be unrated.

I believe I can beat the whole team if this contest is rated for me(they are too slow) but it's unfair to all Div.2 participants. plz unrated this account.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Why so many people solved F but only a few solved E?

»
2 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Thanks,I reach master!!!I've waited a long time for this day

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Thanks!I reach Candidate Master!

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

HI Bbicorz ET01orz user333orz

»
2 years ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

very nice contest! And I solve all problems!

»
2 years ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Thanks a lot... I got my new best rating..