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

Автор cdkrot, 7 лет назад, По-русски

Всем привет!

Сейчас проходит первый тур Открытой олимпиады школьников по программированию, а уже завтра состоится второй. Олимпиаду подготовила Московская методическая комиссия, известная вам также по Московской олимпиаде школьников по программированию, Московской командной олимпиаде и олимпиаде Мегаполисов (раунды 327, 342, 345, 376, 401, 433, 441, 466, 469, 507, 516, 541)

Открытая олимпиада составляется из самых интересных и сложных задач, которые были предложены многочисленным коллективом наших авторов, поэтому мы решили провести рейтинговый раунд Codeforces, который состоится 08.03.2019 12:05 (Московское время) и будет основан на задачах обоих туров олимпиады. В каждом дивизионе будет предложено 6 задач и 2:30 на их решение.

В связи с этим мы просим всех участников сообщества, участвующих в соревновании, проявить уважение к себе и другим участникам соревнования и не пытаться читерить никоим образом, в частности, выясняя задачи у участников соревнования в Москве. Если вы узнали какие-либо из задач Открытой олимпиады (участвуя в ней лично, от кого-то из участников или каким-либо иным образом), пожалуйста, не пишите раунд. Участников олимпиады мы просим воздержаться от публичного обсуждения задач. Любое нарушение правил выше будет являться поводом для дисквалификации.

Задачи соревнования были подготовлены vintage_Vlad_Makeev, isaf27, Flyrise, cdkrot, GlebsHP, ch_egor, Zlobober, qoo2p5, grphil, achulkov2, Schemtschik, akvasha, mingaleg, V--o_o--V, wrg0ababd, под руководством ch_egor, cdkrot, GlebsHP, Zlobober и Андреевой Елены Владимировны.

Задачи для второго дивизиона были доработаны KAN и MikeMirzayanov, которому мы также говорим спасибо за системы Codeforces и Polygon, который использовался при подготовке задач этой олимпиады.

Всем удачи!

UPD: Поздравляем победителей!

Div.1

  1. sunset
  2. Petr
  3. Radewoosh
  4. ko_osaga
  5. orbitingflea

Div.2

  1. appplese
  2. al3xstr33t
  3. Charlene_Hao
  4. ytxytx
  5. QDEZ604

Разбор скоро появится

UPD: Разбор

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

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

Раунд состоиться

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

You mean round #545?

Edit: got fixed.

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

i wish this contest will be my chance to become candidate master

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

Just be careful with any streams.

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

it is like asking thieves not to steal.

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

Hopefully this contest will not end up with "Let's solve problem just for fun"

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

is it rated?

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

Another potential unrated round :)

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

Hope not two unrated contest happening in a week..

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

Looking forward to solving a problem by kun :D

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

Not a good timing for Indians. :(

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

We should believe in Codeforces that they won't make mistakes any more. (ง •_•)ง

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

Not a suitable contest timing for Indians. :(

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

Why everyone should know that this contest is based on Moscow Open Olympiad in Informatics? I think it is better to hold information like this in secret or announce it after the end if the cheating is possible.

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

Best contest time for Japanese! Yeah!!!

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

╮(╯_╰)╭, just have fun~

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

When will the editorial be published?

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

Meanwhile in my timezone

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

Scoring distribution?

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

О да, и раунд напишу, и с девушкой вечером погуляю...

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

getting "you have already submitted this code" for all submission I'm making .-.

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

CF rounds quality is coming down everyday and we see more and more(unbalanced,unrated,unusual,...) rounds...

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

У автора закончились идеи на новые задачи , так что теперь он просто изменяет текст условий предыдущих

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

ewww moscow

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

Can't solve last 2, but all problems were interesting. :)

(Also need to go back to sleep now).

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

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

A few unbalanced round. (maybe not a few).

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

Is it only me or every one that thought this contest was unbalanced?

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

Kudo for the pretests :D
Btw, anyone have any ideas of pretest 16 of Div1C? :D

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

How to solve Div2. B?

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

Saw a bug in my A after I locked in. Feelsbadman

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

How do you do Div. 2 B? :O

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

Was Div2 F only simulation of tortoise and hare algorithm?

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

I tried to hack one of the solution, I uploaded script (which generates testCase) several times, but all the time, there was Generator compilation error. Could you teach me how to hack using generator scripts?

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

    You must strictly follow the format of the input data up to spaces and line breaks; For example, in problem Div2 A script generator would be

    #include <iostream>
    using namespace std;
    
    int main(){
        int n = 100000;
        cout << n << endl;
        cout << 1 << " ";
        for (int i = 1; i < n; i++){
            cout << " " << 1;
        }
        cout << endl;
        return 0;
    }
    

    make sure that you have cout << endl; in the end of the code and spaces in right place; here is a generator that will not compile (because of unnecessary spaces int the end of line)

    for (int i = 0; i < n; i++){
            cout << 1 << " ";
        }
    
»
7 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

How to solve Div2. B?

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

That moment when you solve C and D but cant solve B :(

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

Was Div2 F(Div 1D) only simulation of tortoise and hare algorithm?

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

It took me 30 minutes to realize that in C the tour can last more than one week. Granted, if that wasn't the case, the problem would be equivalent to Hamiltonian path, and in the second sample the path lasts 6 days, but I still think that the problem was unclear. Nowhere in the statement does it say that the tour can last more than one week :/

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

B on div2, is hardest B question I ever see in codeforces . what's the goal of designing such question ?

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

Thanks for an amazing contest!

Solution for D:

Move (0, 1) and (0) (2 operations) while their positions don't coincide. If we have done k such operations we must have 2k ≡ k(mods), . Now start moving all the pieces together. After t moves they all will be at the desired point: as 2k + t ≡ t(mods), pieces 0, 1 will get there, while 2, 3, ..., 9 will obviously get there for the first time.

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

I solved A, and then I just read problem B -> C -> D -> B -> C... again and again...

CF 545 made me iterator function...

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

B on div2, is hardest B question I ever see in codeforces . what's the goal of designing such question ?

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

How to find t in div1D? (if I not mistaken we can find c due to fixed players on positions with index 2^i, before first time we meet fixed player)

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

Fun fact: Problem D is used as a subroutine in algorithm for subset sum in O(20.86n) time and polyspace.

I have seen this on a lecture a few days ago, which explains why I was so fast in solving this problem :P.

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

In div1C was O(N*D) the correct time complexity of the solution? I had TLE 11 witk making a graph with nodes associated with pairs of cities and days ( n*d nodes, m*d edges) What were other aproaches?

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

Even additional half an hour didn't help me to solve B and C. I guess they were hard not only for me.

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

Div1 AB may be a little bit too easy.But I just have no idea about Div1C...

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

When I see a problem from school olympiad in which you have to optimize constant for O(dn) solution...

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

Am I the only one that thought that D was easier than A, B, and C :)

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

What is solution for C div 1 ?

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

that contest was tough one..

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

can anybody help me in knowing why my solution to div2 d is giving wrong answer on pretest 6. sol link : https://mirror.codeforces.com/contest/1138/submission/51026146 Thanks in advance

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

wanted just 2 or 3 secs more. Coded the correct solution for B, going to submit and contest over.

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

Please judge my first prepassed solution on Div2D! The difference between my first solution and second solution is just number of comparisons of hash value of intervals.. I got TLE on second :(

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

very nice contest ^_^ thank you all

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

I got WA on test 70 for D :( I knew it was too good to be true.

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

Why it always have to be so long time after a contest to wait to submit my solution

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

how to solve div2 D?

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

    Maybe : Find first position i in string t such that t[i...n] is equal to some prefix of t i.e equal to t[1...n-i+1]. Then build new substring from that position keeping count of zeroes and ones left. Hashing can be applied.

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

    you can solve it very easily using some help of Z_function algorithm which tells you which idx can be prefix of the same string example:

    string s="11000110"

    you can see that at idx 5 will have a prefix to the main string which is 110 (that's what the z_function get) so from here you can deduce that after you made up the first string just concatenate the remaining string starts from idx 3. i hope you understand what i meant to say.

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

I tried to hack one of the solution, I uploaded script (which generates testCase) several times, but all the time, there was Generator compilation error. Could you teach me how to hack using generator scripts?

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

What's with upsolving?

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

Hi guys, I hope you enjoyed round!

In case you wonder why upsolving is not available yet -- it's intended, since the onsite events haven't finished yet. It will be open in roughly 2-3 hours.

About editorials, we will be happy to publish them after we finish with the onsite as well.

Thanks!

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

My Solution For Problem E can be hacked by n = 1, m = 3e5. Then we preform 299998 times 3 1000000000 1000000000, and then we perform 2 999999998 (10^9 — 2) and then go 2 1. In this way my solution (and many of solutions that get passed) will get a number exceeding the upper bound of the type long long. I think the test is too weak.

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

    This is forbidden, isn't it?

    Also it's guaranteed that the integers Ai will not grow too high. Formally, it's guaranteed that if we sum the largest addition over all events of the 3-rd type (that is, b + (n - 1)·s, where n is the number of cars at that moment) then the acquired sum would be at most 1018.

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

      Sorry, maybe I don't think my data is forbidden. For example, in your code.
      ~~~~~ pts.push_back({r, -overall_b — overall_s * (r — l)}); ~~~~~ "-overall_b — overall_s * (r — l)" this sentence will lead to a exceeding of long long.( And This is not the real value! It's just a tag.) And I have carefully checked that my data satisfies the conditon mentioned in the statement.
      ^_^

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

Is here any other guy's solution for 2c/1a is O(n^2*log(n)) and got tle? I used treap and the time limit seems too tight for me,LOL My brain is quite strange :\

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

What is test 70 on Div2D/Div1B?

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

-100 rating hmm nice number that made forget how terrible I did

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

The contest has ended and it shows Final standings but I am unable to make any submissions. Is it a bug or am I missing something here? It says you need to be registered for the contest. Edit1: I believe I am not the only one who might have missed kun's comment. For those who have gone ahead to downvote, it would be helpful if you could mention the reason for the same.

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

when it will be available to submit a solution?!!

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

Tricky Contest##!!##

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

How can I submit my code after the contest? It says I am not registered for the contest :(

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

I missed the contest. Is there any way to participate virtually? I see no options there.

Edit : Thanks. Got it.

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

meme

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

Hello, What is the souliton of div1 C, div2 E?

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

Does anybody know how to get/copy a test case that is finished with the ellipsis "..."?

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

    You really want to debug your code on a test case that is finished with the ellipsis "..."?

    I think there is now way now.. but you can go through other test cases from a AC solution and get a smaller test case that gives WA for you

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

div2b can anyone plz tell me what's wrong with my 51023192 . the basic idea is:

for 1st performance i iterate over all possible clowns (clowns+both_skilled).all the other both_skilled goes to 2nd performance. then i take some acro in the 2nd to make it equal . then rest of the acro goes in 1st performance. and rest of the clowns go the 2nd. and fill others with no skill actors. if all verifies i take that number of clown and print

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

How to solve div2D / div1B?

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

Ahhhh...
Finally that's my best rating change (+318) ever...
Here is my personal log on the contest:

  • 0min Start. Don't know whether to participate.
  • 15 mins. Read C,D,E. Thinking on C and fail.
  • 25 mins. Come up with the idea of E. Decide to participate and start to write B.
  • 34 mins. PP on B, reading A.
  • 51 mins. PP on A, start doing E.
  • When doing E, I basically debugged for around 20 mins just because I made the order between the slope and the intercept wrong when I read the b and s in the task (i.e. read in the order s b instead of b s).
  • 98 mins. PP on E, trying to do C and D.
  • The ten friends in D is really misleading. Finally when I figured out that 3 of them would be enough, it is already 145 mins after the start. In a rush I finished the last piece of code (and made it wrong for the first time) and submitted on 148 min. PP.

Before the contest I wanted to get around +200 to get myself a yellow, but the result is really good for me. Thank you all for the fun and exciting round!

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

How to solve D1C/D2E?

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

What is test 73 for div1C?

It looks like many people failed on it (including me)

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

cdkrot, I found some accepted codes of F is quiet similar, why no skip? 51026411 51023578 51025400 I don’t believe that there is such a coincidence.

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

Why I get RE on test 8 for div2 problem B ?? https://mirror.codeforces.com/contest/1138/submission/51062872

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

Why I get RE on test 8 for div2 problem B?? https://mirror.codeforces.com/contest/1138/submission/51062872

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

cdkrot MikeMirzayanov KAN

https://mirror.codeforces.com/contest/1138/submission/51062541

https://mirror.codeforces.com/contest/1138/submission/51021650

are exactly the same for the problem 1138C, yet I got a TLE during the contest.

Any chances for getting it rejudged?

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

so, where is the editorial? it's about two o'clock(UTC+8).

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

0rating

Now that's a first...

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

I got Accepted in 1138B - Circus in Div. 2 with Brute force on a, b, c, d (which are the numbers of different types of artists).

I just want to know how to prove the time complexity of this algorithm?

My submission is 51069702.

Thanks for everyone. :)

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

My O((N + M) * d) solution for Div2 E. / Div1 C. times out on test case 18. Could anyone tell me what is causing this? https://mirror.codeforces.com/contest/1137/submission/51080307

Edit: TLE resolved by making the DP iterative.

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

In question 1.C I got RE The main problem is

void bfs(int x,int y){
	if(vi[x][y])return; vi[x][y]=1;
	V.push_back(mp(x,y));
	for(int l=e1.son[x];l;l=e1.nextt[l])if(tong[e1.ed[l]]==tong[x])bfs(e1.ed[l],(y+1)%d);
}
// bfs is actually dfs

If you change the vector to an array, you can get AC

In fact, the dfs depth of the program can reach 5000000

Why is that?

Specific can see

51145858 51016401

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

-

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

ohhh thats so cute of you to congratulate me, you didn't have to, <:)