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

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

Всем лучей добра!

Приглашаем вас поучаствовать в предстоящем 426-м раунде, который пройдет в это воскресенье в 17:35 по московскому времени. Если вы считаете, что раунд от фиолетового — это плохой знак, то спешим вас огорчить (или, наоборот, обрадовать): над раундом трудились сразу двое фиолетовых — я (xen) и GreenGrape!

Раунд будет проведен по классическим правилам Codeforces и будет включать в себя по пять задач для каждого из дивизионов, три из которых — общие. Длительность раунда — два часа. О разбалловке по давно сложившейся традиции мы сообщим лишь незадолго до начала раунда.

В этом раунде вы будете помогать Сластёне — известной любительнице конфет, зефирок, кексиков и прочих прелестей кондитерского искусства! Помимо сладостей жизнь Сластены также изобилует и интересными задачами, которые ей не всегда под силу решить без вас.

Тестировать задачи нам помогали Кирилл Seemann Симонов, Евгений rek Тушканов, Егор Voudy Спирин, Евгений WHITE2302 Белых, Владислав winger Исенбаев и Александр AlexFetisov Фетисов. Спасибо Артуру tunyash Рязанову за предложенные идеи по задачам, нашедшие отражение в нашем проблемсете. Огромное спасибо координатору Николаю KAN Калинину за то, что помог нам довести дело до конца (и терпел нас, пока мы кропотливо фиксили косяки), и, конечно же, Майку MikeMirzayanov Мирзаянову за замечательные платформы Codeforces и Polygon!

Будет ли раунд рейтинговым, спросите вы? Мы ответим, что сделали все возможное для этого, и не намерены отступать от плана :)

В любом случае, желаем вам удачи/решений без багов/высокого рейтинга/whatever, и надеемся, что задачи придутся вам по душе и скрасят вам прекрасный воскресный вечер.

UPD. Разбалловка будет такой:
Div. 1: 500 – 1250 – 1500 – 2250 – 2500
Div. 2: 500 – 1000 – 1500 – 2250 – 2500

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

Div. 1:

  1. Radewoosh
  2. LHiC
  3. VivaciousAubergine
  4. SanSiroWaltz
  5. W4yneb0t

Div. 2:

  1. nguyenthibanh
  2. ColdSu
  3. LLX
  4. EnjoyCallen
  5. pr3pony

UPD 3. Разбор


art by Ilya Shapovalov

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

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

are the problem statements as long as this blog ? :|

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

Sir, how can you wish high rating for all of us??!! As on codeforces rating system it is not possible to get high rating for everyone in a contest ( As far as i know) . :)

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

Slastyona is beautiful <3

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

Очень понравился анонс!

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

This should be...the sweetest announcement to a contest.... ever! Kudos, man xD

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

This should be the .... sweetest announcement to a contest ..... ever! xD

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

I wish the problems as beautiful as Slastyona ☺☺

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

I liked your style of writing, looking forward to seeing as interesting problems as this blog.

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

Good luck every one and have fun

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

Wow! I just read the whole blog in one breath! You would make a great writer if you weren't a problem setter! :D

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

Don't know about the problem statements, but it feels good to read such announcements which are fun to read :) It helps to set the mood for a good contest :) Thank you authors!

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

I am new to Codeforces. Hence my rating is less than the required rating(>1900). Can I still view the questions?

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

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

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

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

deleted

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

Is it rated?

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

We will miss IOI participants :(

Good luck everybody

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

IOI participants and some coaches are AWAY? TIME FOR AN ORANGE HANDLE!

(Text: I have a BOLD idea)

Edit: My feel after the contest

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

I am really sorry, but that animation character seems really gay

I hope problems are not the same

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

Многим не понятно это предложение Будет ли раунд рейтинговым, спросите вы? Мы ответим, что сделали все возможное для этого, и не намерены отступать от плана :)

Зачем вы это написали?

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

Why contests on CF is holding at 8:30 pm(BDT) now a days.. It used to held at 9:30 pm before... ???

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

The illustration is awesome.

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

^ v 6 why this case is "undefined"? ^>v<^>v = 6 isn't it possible in 6?

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

I think people who live in a country called "Sweetland" look a little different

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

I used to type scanf, but used cin this time and forgot to type cin.tie(0) ,so I got lots of TLE on PC. Now, I know how to solve PD, but I'm out of time. QQ

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

What was the hack case for div2 A ? ( Please Tell After Contest )

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

    Let's denote:

    • cw_state is the Toy's state we achieve if we rotate it in clockwise.

    • ccw_state is the Toy's state we achieve if we rotate it in counter-clockwise.

    Then:

    • "undefined": cw_state = ccw_state OR (final_state != cw_state && final_state != ccw_state)

    • "cw": if cw_state = final_state

    • "ccw": if ccw_state = final_state

    Hope you find it useful

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

DIV2 seems to be dominated by Chinese participants... 8 in Top 20 and 16 in Top 40. DIV1 also has 6/20. Any idea why?

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

Could someone explain DIV2C? 834C - The Meaningless Game Out of ideas here =(. My approach does not seem to pass in time. My bet is that there is some relation with the exponents of the prime factors of the a, b given.

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

    This is my simple decision but so far I do not know whether it's right)

    http://mirror.codeforces.com/contest/834/submission/29014215

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

    Assume, Slastyona won when k1, k2, ...kx were chosen, and Pushok won at k(x + 1), ...kr. There x — number of rounds which Slastyona and r — number of all rounds.
    Then A = k1 * k2 * ... * kx, B = k(x + 1) * ... * kr.
    Then a = A2 * B;b = A * B2
    So if B = a / A2 then b = A * (a / A2)2 and b = a2 / A3. So a2 / b must be cubic. Anaogically b2 / a must be cubic either.

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

    a can be written in form x2y and b can be written in form xy2 from this we can write ab as (xy)3 with binary search we find xy then check if really (a / xy) * (b / xy) = xy.

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

      Does C++'s cbrt function do the cube root finding in O(logn)? I did the same approach but was getting TLE on a pretest.

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

        I don't know the implementation details of cbrt, I think it may use binary search and then Newton's method or some other fast converging series, but I'm not sure. But I think your solution's slowness comes from working with floats, because they bring a lot of unnecessary precision: we only want to decide if a number is cubic or not and if so the cubic root of it. Compared to cbrt we do a lot less work, cbrt actually calculates the exact cubic root with much more effort.

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

        You are using slow output. Use printf instead of cout, when you have to print out a lots of lines (3*10^5), also use "\n" instead of endl.

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

      A binary search isn't even necessary. We can just precomp all of the perfect cubes up to 10^18 (there are only 10^6 of them) and store them in a hashset or set. Depending on languages queries will be O(1). Easier to implement too :)

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

    O(1) solution: Find . If it's not an integer, return NO. Otherwise, if s divides both a and b, return YES, otherwise return NO. (Cube root can be found by binary search, for example.)

    To prove that this works, note that ab must be a cube, since every round it is multiplied by k3 for some k. Moreover, if we set ab = s3, then the product of all k played in the game is s. Thus we need to have both a and b divisible by s, since they are the product of all k played in the game, plus probably some more numbers. And this is all we need; if ab = s3, let a = sx and b = sy, so we see xy = s. Thus a = x2y, b = xy2, so one possible game is a winning a game with k = x and b winning a game with k = y.

    EDIT: To avoid TLE, use very fast input/output methods because you're reading 700k numbers.

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

Ouch, should've used persistent segment tree instead of wavelet for div1B ... I am not familiar enough with it to make adaptations :/

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

Can Divison2D / Div1B be solved by D&C DP???

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

I proudly continue the tradition of finding the stupid bug less than 60 seconds after the contest ends. Ouch!

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

    Same here, I found the bug is the last 10 seconds but do not have enough time, maybe 5 more seconds can save me. Here's my bug: array size 50 -> 51 Silly enough

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

How to not TLE on Div 2 C? I got 20 submissions (seriously, you can check it out xd) and anything I did it got TLE.

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

How to solve Div2C?

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

Was nklog^2n not supposed to pass for Div2-d?Divide and conquer dp optimisation with persistent tree was giving tle on test 11.

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

    You can remove the logN factor. Update costs in O(1) when moving from i->i-1, by checking the next_right occurrence of current value is > mid or not. Use the query to persistent segment tree only for the rightmost valid split point and henceforth use the above trick.

    You can see my code for the same.

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

      Wait, whoa, do you need to use a persistent segment tree? As in, why can't you just loop from the rightmost valid split point? It should be O(NKlogN) because each number is in at most O(log N) ranges, right?

      EDIT: Yay, I passed :D

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

    During contest in last minute,I tried to memoize some part on those values.But my bad it got MLE. Then I lowered the Memory for memoisation.And now O(n*k*logn*logn) passes the TL.

    Code:29025279

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

In DIV 2 C,if the product of the scores is not perfect cube the answer is surely NO. Why did I get Wrong answer then? My solution

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

Is there a clever solution for Div 2 E/ Div 1 C, or it's just case analysis?

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

What is solution for B div 1 ?

I have tried some DP with greedy part, but first it was wrong, than I got TLE.

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

    A well-known technique from here. Inside the DP, one needs to compute # of distinct numbers on a segment, which is also a well-known problem (can be e.g. solved with persistent segment tree). <offtopic>I don't understand why authors would suggest such a problem, with exactly zero ideas, which is solvable just with trendy standard techniques... </offtopic>

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

      Thanks !

      At least I had part with persistent data structure :D For second part I tried some greedy, brute-force etc. But everything was WA or TLE. Also I am not sure how solution in complexity O(n k log ^2 n ) gives AC, when I tried my wrong O(8*nk log n) and got TLE :D

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

      Can you prove why Divide n Conquer is applicable? I used it because I had a strong intuition but no concrete proof.

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

      Oh, I thought about D&C, but didn't realize subproblem can be solved using persistent segtree. I actually found that problem pretty challenging. After a lot of thinking I came up with a nontrivial idea that required segtree that takes largest sum of suffix ending at given position (but made a stupid bug, so it didn't pass pretests). Actually, at least it has better complexity ( instead of ).

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

      I found that problem good, I solve it without any "special" dp technique, just solve the standard dp with data structure to speed it up. Overall complexity O(n * k * log(n)).

      Note: I used segment tree, but no persistence.

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

        Yeah, the solution with regular dp seems nicer. The issue is, for people familiar with divide-and-conquer optimisation and "count unique numbers on a segment" problem, the solution is obvious right away (but then might take a while to implement, but this is my personal issue).

        Let me elaborate why I don't like such problems (which can be solved just by applying standard hammers). Imagine a problem which can be solved either by a complex standard algorithm (e.g. ukkonen), or with a tricky idea. Then there are three options: (1) someone knows the algorithm and has it prewritten, (2) someone knows the algorithm and doesn't have it prewritten, and (3) someone doesn't know the algorithm. Then the contest goes as follows: people from (1) solve the problem in a few minutes, everyone sees it on a scoreboard. Then people from (3) think for a while and come up with a custom solution. Finally, people from (2) are screwed the most — the solution is obvious to them, and it is obvious from the scoreboard timing that everyone submits precisely this solution. And then they spend infinite amount of time to actually implement it.

        This turns the contest into some weird competition highly dependent on knowing the algorithm and having its implementation. That's not what programming contests are for, IMO. And that's why I think good contests shouldn't have problems which are solvable by standard hammers. It is fine for educational contests, but not for regular ones.

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

    I think you maybe need some data structure to do it. such a segment tree.

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

Can Div2 D be done somehow with ternary search. We can observe that the required dp expression will be unimodal but not monotonous.

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

in div2 A is this test valid ?

^ ^

6

???

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

Div2 C pretest 9 killed me!!!

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

Problem A is meant for begineers...why 10^9 then...10^5 was enough

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

What's pretest 5 of D?

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

What is the pretest 11 of div2D?

Nice problemset btw. Thanks to the authors.

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

I find Div1A/Div2C to be a very poor competitive programming problem, because of the massive input/output. Many TLEs are caused by reading the input or writing the output very slowly (I got 5 TLEs because I didn't realize this). Is it really impossible to just put n ≤ 104 or something more sane, that doesn't require knowledge about specific programming languages and instead focuses on the algorithmic part?

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

Does something like this work for div1B?(I couldn't fix mle because I didn't have time)

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

Nice round, I like the problems. Thanks authors, great work :)

On a side note, just a little complaint. I don't like the time limit for Div1-C. What kind of sub-optimal solution did you wish to fail by setting a strict time limit? My solution takes close to 2 seconds ...

UPD: Got accepted in 980 ms after heavy optimizations. I see many accepted solutions taking more than 800 ms. Really don't see the point in setting time limits like this. Please try to keep this in mind when you are setting problems in future.

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

This submission for C didn't pass and I'm salty: 28999828

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

I mentioned in another comment that it's possible to solve Div1A/Div2C even when a, b ≤ 1018 in nearly constant time (basically ) without using any integer greater than 1018.

Here's my solution.

This basically means the problem could have used a, b ≤ 1018 and C++ people can still solve the problem, even if they have to take an extra step as above (compared to people with arbitrary-precision integers like Java and Python users, which can implement the step directly).

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

    I implemented this method during the contest, and it turns out that it even runs faster than the intended solution. Probably because long long arithmetics are much slower than int.

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

    The truth is, nobody will care about Python users if that means making problem significantly harder. And making problem easy to Python and Java and far harder for C++ users is not what coordinator should aim at, so your point is invalid. 700000 numbers is far from "massive input" in my opinion and slow input in Python is much less important issue than making problem three times harder for C++ users.

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

slowest system testing :(.

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

[Suspicion of cheating]

Look at ColdSu submission time, isn't it suspicious? he basically solve div 2 A-C in 11 mins with 2 WAs in between.

If that is not suspicious enough, look at his previous contest, the submission time is very close to each other early on.

Ok fine, maybe he is a really fast coder, so let's look at his previous contest code.

28218772 28213808 28225192 28216740 28232863

We will notice that there is 2 different template, where the first 3 uses same library and the last 2 uses a different set of library.

Ok, maybe he just uses 2 kinds of template. Now, let's look at his tab width. The first 3 and last 2 have different tab width again. Isn't it too suspicious?

KAN

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

slowest system testing :( ...

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

    It's probably because of long execution times on C. However don't be unsatisfiable, they started the system test pretty fast, and 1 h after the contest end it's at 82%, while sometimes they don't even start the system test by 1 hour after the contest.

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

Figured out a solution for Div2 D problem using persistent segtree (to count different elements in range) and divide and conquer optimization for dp. Could not code it at time, but I'm glad to see people getting AC with this solution. One of the best problems I've seen on Codeforces. Congratulations to the writer =)

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

huehuehue

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

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

I got accepted on Div.2 C o(N*170)!

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

rating predictor?

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

I got timeout in C because I put:

    ios_base::sync_with_stdio(0);

Instead of:

    ios_base::sync_with_stdio(0);
    cin.tie(0);

I hate this round!

P.S. Is CodeForces became harder recently? I previous 3 contests I couldn't even solve B. I've been blue...

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

    Same thing. I added cin.tie(nullptr); and replaced endl with '\n', and now my solution passes easily (343ms).

    In the past ios::sync_with_stdio(false) has been sufficient. This is bullshit.

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

      Same thing, but in upsolving =)

      But hopefully we learn something today.

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

        But hopefully we learn something today.

        Unfortunately, it won't help in my case. There are unlimited number of tiny things to know in order to get it right.

        So today, I missed a tiny thing a_n, previous 3 rounds I missed another tiny things a_(n - 3), a_(n - 2), a_(n - 1).

        The problem is that when after k rounds I will need some tiny thing a_(n + k) and even if a_(n + k) == a_(n), I most likely forget a_n by that time.

        The only way to get improved in competitive programming is to solve problems at higher rate than forgetting tiny things.

        In my case of having full-time job and participating/upsolving once/twice a week, I learn tiny things at the same rate I forget them. That's why my rating is completely flat over fucking years (after removing statistical noise).

        I enjoy very much learning new concepts and new algorithms but my rating is not high enough to solve interesting problems using interesting algorithms (segment trees and more).

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

    Same here. Lost 100+ rating:(

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

For Div2C, two conditions are necessary

  1. a*b should be perfect cube.

  2. gcd(a,b) should be divisible by cube_root(a*b)

How to prove second part? I found it by observing few test cases and intuition.

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

Problem C was very-very nice, respect to the authors

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

Please help me with my solution of Div2 — C. http://mirror.codeforces.com/contest/834/submission/29023242

The output from my system matches the jury's answer for visible inputs but the codeforces system gives the wrong answer.

I have seen the correct approach for the problem, want to know what error caused this for future reference.

Thanks

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

Can someone please elaborate on how to solve D without dp optimisations?

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

Any tip for Div1D?

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +7 Проголосовать: не нравится
    1. "the numbers of red and black threads differ at most twice" sounds like a bad condition to me. Let's change it. Let R and B be the number of red and black threads on the path. One can verify that the original condition is satisfied if and only if R - 2B <= 0 and B - 2R <= 0. That's much better because this condition is additive (that is, we can glue two pieces of a path together knowing this pair (R - 2B, B - 2R) of values for each piece).

    2. Let's assume that we fixed a vertex v and we what to count the answer for all path that go through it. We can represent each vertex as a pair as shown above. After that, we need to count the number of such other pairs that the sum of their first and second elements are both non-positive. It's some kind of "sum in a rectangle" queries. We can do it in O(N log N) using sweep line and a binary index tree. We also need to subtract the pairs from the same child of v (it's done exactly the same way).

    3. v is not fixed, though. But it doesn't matter. We can fix it using centroid decomposition.

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

what's wrong with the this code for DIV2/B. same code code got AC with cin instead of scanf. RunTime Error Code-:Your text to link here... Correct Code-: http://mirror.codeforces.com/contest/834/submission/29003340

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

Div2 D

Contest submission: typedef long long ll; (TLE)

While upsolving: typedef int ll; (AC)

dont know when i am gonna stop using typedef and #defines

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

How did ColdSu manage to get purple from green in three rounds?

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

Does anyone have any idea on how long it is before we get the English editorials?

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

Got Div2 C TLE because I used endl and did not include cin.tie(0); Fucking bullshit!!!!!

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

Woke up today morning and saw both my submissions were 'skipped'. Can someone explain why that happened ?

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

what's wrong with my code about Div2 C? 29017171

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

Div 1-C problem's time limit is quite too tight. I have a solution with complexity O((K+9,K)*log(K)*K) but takes 4 seconds for test max.

My code: #29034060

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

I keep getting WA on test 2 in div 1 A 29038659. I dont understand what is wrong with my program

UPD: It's fixed now, just consider case:

1 25000 5