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

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

Hello, Codeforces!

waaitg, Cocoly1990 and I are glad to invite you to Codeforces Round 906 (Div. 1) and Codeforces Round 906 (Div. 2), which will take place on Oct/28/2023 17:35 (Moscow time). In both divisions, you will be given 6 problems and 2 hours and 30 minutes to solve them all. Note that one of the tasks is split into two subtasks.

We would like to thank:

Score distribution:

Div. 2: $$$500$$$ — $$$750$$$ — $$$1250$$$ — $$$2000$$$ — $$$(1250 + 2500)$$$ — $$$3250$$$
Div. 1: $$$750$$$ — $$$1250$$$ — $$$(750 + 1500)$$$ — $$$2000$$$ — $$$3500$$$ — $$$3500$$$

As always, wish you all get a non-negative delta in this round!

UPD1: Editorial

UPD2: congratulations to the winners!

Winners and first solves
  • Проголосовать: нравится
  • +544
  • Проголосовать: не нравится

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

fuka round!

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

As a writer, I think this Round is very interesting.(btw, Please give me contribution.)

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

As a tester, problems are very cool! ><

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

Hoping that it would be a great contest

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

I hope it will be great contest and get more points.

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

First Div1 contest for me! Hope that i can solve at least one problem!

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

I am a newbie, could I take part in Div 2 and solve the easiest problem?

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

Contest timing clashes with El Clásico.

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

As a player, I wanna be red.

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

i was forced to test

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

Thanks for the early Score distribution lol:)

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

Chinese round at usual time. It's unusual, isn't it?

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

hope get positive rating delta

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

can't wait to become blue

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

.

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

Imakf round!

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

This round time clashes with IEEEXtreme (which happens once a year) and many contestants can't do both!

Is it possible to delay this round by one day?

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

I am new to this. Please advice a math book and algorithms book. I barely can solve even 1200 problems

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

    You don't need books, just pick a random problem and try to solve it. When you're stuck change problem or look editorial(read one statement and try to do left part yourself, if you couldn't, read one more, in the end code solution yourself). If you found anything you don't know in editorial just google it. cp-algorithmms and geeksforgeeks are good to learn topics.

»
2 года назад, скрыть # |
 
Проголосовать: нравится -18 Проголосовать: не нравится

Is it rated?

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

Woah, i can see a lot of reds

»
2 года назад, скрыть # |
 
Проголосовать: нравится -78 Проголосовать: не нравится

Clashing with LeetCode Biweekly. Would skip this one.

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

Why do you schedule contests on the same day as IEEExtreme? T~T

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

Impossible wish: "you all get a non-negative delta in this round!"

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

.

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

Grandmaster when?

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

Hope to be candidate master tonight! (last round I dropped to expert lol)

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

I've been consistently losing rating, wish for a positive rating change for me!!!

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

Hope IM.

Upd: Success!

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

All top 4( 3700 rating) registered for this contest.

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

Yes/No contest

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

6 WA for C Div. 2 C problem. i will get -100 delta :(((((

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

Back to Specialist :(

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

Hopefully expert

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

I chose not to participate in this contest because Imakf had published the editorials accidentally with just codes beforehand and it was there for around a minute or two. Looking at them gave me an unfair advantage in understanding the used data structures and algorithms. Entering the contest with those ideas would have been an act of cheating, so I decided not to participate. Instead, I did leetcode biweekly.

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

Why such a tight time limit in D and E1...

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

can E2 be done with bitmask dp?

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

how do you do C?

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

How do you prove Div1A? I spent 30+ mins trying to prove the obvious approach and got no where before just deciding to try to proof by AC (which worked).

It feels way tougher than Div1B and C1. Div1B actually feels more like a typical Div1A to me in that sense — It requires one fairly simple observation which has a straightforward proof. I suspect the solve counts on it would be equal (if not higher) if their places had been swapped.

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

Finally I got negative delta -_-

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

How to solve C?

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

For C problem(Div 2)

answer exists when number of ones=number of zeroes in input string

but how do we construct answer ?

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

How to solve E faster than $$$\mathcal{O}(n\log(n))$$$?

Also, what's wrong with my solution to D? 230219737 It looks linear to me.

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

    Ok, authors' solution (from editorial) to D works 998ms (time limit is 1s): 230265951. With other compiler 842ms: 230266166. After changing it to use vector like a human being instead of array operated like a stack both times go up.

    Authors' solution to E maybe takes 1247ms (230266784) out of 2s (yeah, that's already way too much) but it doesn't even use any vectors while there two damned trees on the input and we are supposed to create another graph and find SCC in it.

    I don't want to complain, but I actually do. These time limits are a joke (and they would be bad even for these squeezed model solutions, which shouldn't be optimized at all) and I strongly suffered because of them. I expect some action from authors or coordinators (or if I'm retarded and wrong somewhere tell me that).

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

      It's my fault. All the submissions from testing got AC comfortably, so I assumed the time limits were fine and I didn't check the running time of the official solutions.

      Next time I will double check.

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

        Thanks for sharing--incidentally, does anyone know why the authors' solution to D is so slow? My code (not optimized at all, makes full use of vectors) runs in 340ms, and a priori I'd be very surprised to see a linear solution with the given bounds take a full second.

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

      I'm sorry. But it is strange that on polygon the intended solutions do run faster or inconsistently, compared to on main site.

      For D, intended solution runs 498ms (with stacks and without any optimization), and one of the testers runs <= 220ms. Considering the implementation for this problem are barely the same for most people, we set the TL to 1s.

      For E, intended solution runs 888ms, and errorgorn's HLD solution runs 795ms. Anyway, for this problem, the TL is tight. It's better to set 4s. I apologize for that.

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

        I'd rather win a round than get an apology, but shit happens. Problems were nice anyway, so don't give up.

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

        Maybe it’s good to say something constructive. Every time when I hear that someone is choosing the time limits to (constant)*(model solution) I lose my mind — it doesn’t work like that at all, it strongly depends on the problem. To choose the time limits you should have possibly many approaches implemented and consider why some of them are slower than the others and what do you want to expect or/and at least consider “what actually could people do in this problem”, like “is it tempting to do something more complicated?” or “is it tempting to repeat something three times?”. For example in yesterday’s E it would be “what if someone wants to create graph with vertices not only for each power of 2 jump, but also extra ones for each edge and vertex of the trees?”. I wouldn’t solve that this way, but I wouldn’t say that it’s impossible.

        Errichto once told me something that works in theory and is kind of automatic. He said that a good way is to set the time limit to be equal to the geometric mean between the slowest solution that we want to allow to pass and the fastest that we don’t want to pass. In practice it doesn’t work like that. An example is a problem with $$$\mathcal{O}(n\log(n))$$$ model solution and slower $$$\mathcal{O}(n\sqrt{n})$$$ solution — it might be a case that we’d have to accept the fact that the squeezed slower one might pass to make the model one pass comfortably (or try to change the problem/limits to fix the issue if it’s possible). For example in yesterday’s D such solution is probably link-cut based — I guess you wanted to don’t let it pass, that’s ok, but I don’t think that 1 second is really necessary to do it with one million numbers on the input.

        About time limits in the round there is also a general stuff. I think if someone asks about most classic most popular cf time limit, the answer is “2 seconds”. So I’m surprised that time limits set to 1 second in many problems where the solution isn’t something that would obviously take zero time (like $$$\mathcal{O}(1)$$$ or $$$\mathcal{O}(factorization)$$$ for $$$n$$$ up to $$$1e9$$$) didn’t bring any attention. Also these 2 seconds are meant for the problems which don’t do anything crazy and problem with $$$\mathcal{O}(n\log(n))$$$ size tree-structure sounds way more complicated. So I don’t think that either 2s for D or 4s for E are automatically good choices.

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

      I think your solution's slow runtime on D (as well as the authors') is caused by an I/O bottleneck. I resubmitted your first skipped solution using cin/cout with standard optimizations (ios_base::sync_with_stdio(0); cin.tie(0);) and then with the original code (in case the slow runtime was caused by poor server performance during the contest). See below (first two results are your solution, next two are with cin/cout):  Switching to cin/cout cuts your runtime by about 500ms, easily fitting your solution into the time limit.

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

      The author's solution is hacked (tl). Hack And Benq's solution during the contest also didn't survive.

      And the hack test case is not even carefully constructed. It's just two random chains. I didn't see the TL of this problem make any sense. And it's totally unfair that heavy-light decomposition can pass this problem and binary lifting can't.

      Although I didn't solve this problem during the contest, I feel it's better to rejudge this problem with a larger TL.

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

      I went here to check if you complained (and if not to complain myself).

      There is a tendency for Chinese authors to write insane constant optimized solutions and then set TL 2x (or worse) from them. I remember one ptz contest where the bottleneck was calculating nimber multiplication, and TL was set as 1.5x from a solution that uses the fastest nimber multiplication code from yusupo judge.

      I don't want any rejudges or anything, but I want coordinators to check those kinds of things.

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

D's idea ?

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

For Problem C Div-2 : Who else overthinked and overkilled just by ignoring n<=100 constraint..??

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

bad task div1 C

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

timelimit on E1 so tight (for python atleast) ;(

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

any E ideas? I try scnaline, but, not working for me :)

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

Why always use 1 works for div2D?

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

Why do I suck at greedy problems like D?

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

Can someone explain the idea behind the problem A in div2

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

20 points away from CM...

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

Casting an ancient curse on Div. 2 problem C authors.

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

    Hey, that's my line!

    Honestly I think that C is not that bad, D however seems a bit troll: 2000 points for a problem where you can just connect the first node with any of the nodes that come after it (not even a real graph problem, just a tiny bit of math).

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

      Sorry for stealing your line =)

      My take on it is that figuring out why connecting everything to the first node in D is correct is much better than calculating all the correct indices on every iteration of C.

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

E2 was easy just read the constraints k<=10 bruh

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

What is this message? I was so scared thinking my fraud solutions were exposed and hacked manually by authors

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

Test cases are very weak for Div.1 B, my solution for B passed even on using int, should not this test case be available in pretests

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

screwed up so bad lol

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

1D is one of my favorite problems I've solved in a long time. I was working towards a totally different solution path when I realized that we could drop cycles to solve the problem in one move, at which point I spent several minutes thinking to myself about how cool that observation is before going to implement. Thanks to the authors!

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

https://mirror.codeforces.com/submissions/jiangbowen/contest/1889

Imagine solving C2 and getting FST on C1 lol

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

It was a very interesting round! Thanks to the Authors!

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

Guys, here is my submission for Div2 — E1 problem. It says TLE however, I can see there is output printed for the TLE testcase

MikeMirzayanov Cocoly1990 Imakf waaitg , this looks like a linear time-complexity difference. Can you guys help here. I think increasing time-limit in such problems will help ??

Also the below 2 submissions for the problem have same codes. But you can see that the problem have different TLE failing test-cases. Submission 1: https://mirror.codeforces.com/contest/1890/submission/230270545 Submission 2: https://mirror.codeforces.com/contest/1890/submission/230272906

Please help here guys /\

»
2 года назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится
Easisest solution for C :   (claim : total_operation <= 50)
    Pre-requiite : observation

    When you see the operation, insert '01' what it means?
             :-> Assume it is like a bracket () , 0 -> +1 , 1 -> -1
                 you can create a Perfect bracket sequence with the operation? (sounds cool)
                 Some property :  pref_sum >=0 , at last pref_sum =0
    Now, lets solve the Problem:
             one pointer at the left end , one at right end
             if(s[i]!=s[j]) -> we can continue,and move the pointer respectively
             otherwise, both is '1' or '0'
                 let '1' : we make pref =0, 
                           when we have an subarray whose pref=0 -> we can compensate it
                           otherwise not possible
                           Now you are confused that from which side we check for pref=0 condition
                           it turns out that  for '1' check from right pointer
                                              for '0' check from the left pointer
                 vice-versa for '0'

            Yaa We are done :

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

It Indeed Was A Great Contest :) :)

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

It was soo cool

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

Thanks for the nice Div2 round. I'm finally CMMMMMMMM.

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

is it too much to ask for another 6 points to become cyan :(

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

I hate Doremy

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

Thanks for such an amazing round! The tasks were truly enjoyable!

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

Finally, I became a master. Thank you for this interesting round!!!

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

problems are good, but i think it could be better to include the statement ("not necessarily adjacent") in div2 E . i thought that the days should be consecutive and fell into wrong idea.

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

In problem B, how is 1010101 a bad string ?? (test case 4)

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

    t=1010101 is a good string. However s=101100 is not a good string, and you cannot make it a good string by inserting t (as often as you want). This is because s contains the substring 11 and even inserting t between those two 1s doesn't help as t both starts and ends with 1, i.e. you just end up again with the substring 11 after inserting t.

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

Wow my first time First Solve . Div2B