Скоро Codeforces Round 1133 (Div. 1, Div. 2)! Регистрация здесь. ×

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

Автор mnbvmar, 8 лет назад, По-английски

Hi Codeforces!

I'm so happy to invite you to Codeforces Round 556 (Div. 1) and Codeforces Round 556 (Div. 2)! The rounds will be held on Apr/29/2019 17:35 (Moscow time). The round will be rated for both divisions. (At least that's what I've been told!)

The problems were written and prepared by me. Thanks to 300iq for the round coordination, and to Radewoosh for his invaluable help with choosing the problemset and testing the problems! Also, I want to give a shout-out to MikeMirzayanov for his amazing Codeforces and Polygon platforms!

My browser's tab bar, right now.

You'll work on 5 problems, and you will have 2 hours to solve them. The scoring distribution will be revealed closer to the round.

def get_end_remark():
    return random.choice([
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!"])

UPD 1: The scoring distribution time!

Div 2: 500 — 1000 — 1500 — 2250 — 2750

Div 1: 500 — 1250 — 1750 — 2500 — 2750

Also, thanks to cdkrot, vintage_Vlad_Makeev and qwertyland who contributed to the round testing!


UPD 2: The round is over! Sorry for misbalancing the difficulties in Div2, it was totally unexpected for us. Meanwhile, you can have a look at the editorial!


UPD 3: We finished the system tests. Congratulations to the winners!

Div 1:

  1. Um_nik
  2. DearMargaret
  3. maroonrk
  4. Reyna
  5. LHiC

Div 2:

  1. jiangly
  2. Simplicity
  3. Netherdrake
  4. C137
  5. kobor

Also, a shout-out to the first solvers of each task!

Div 1 Div 1 Task Div 2 Div 2
Stock Arbitraging 1:57 Ahmad
Tiling Challenge 3:43 Nazarbek_Baltabaev
Petr 2:06 Prefix Sum Primes 4:20 JamesWilson
ko_osaga 16:27 Three Religions 48:20 jiangly
ainta 28:45 Tree Generator™ 109:53 lzoilxy
Petr 53:52 Abandoning Roads
DearMargaret 83:10 Election Promises
  • Проголосовать: нравится
  • +1064
  • Проголосовать: не нравится

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

All the handles who were involved in the making of this round

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

It is will be a great round)

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

I think this contest will be hard because 5 problems if problems was 6 or 7 or 8 it will be easier

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

Finaly an announcement without copy pasted part!

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

It is better for me.

  • def get_end_remark():
  • return random.choice([
  • "You will get a T-Shirt"])
»
8 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

it will be interesting problemset :)

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

First round by mnbvmar !!! Let's hope for an awesome one !!!

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

YAY! mnbvmar gets his time to shine!

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

Sorry, does someone know how to use HTML while writing tasks at Polygon?

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

From mnbvmar's browser tags, I guess there will be 8 different problems in this round. It can be inferred that Div.1's A and B would possible be the same as Div.2's D and E, respectively. So I think this Div.1 might be difficult.

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

"Please, read all the problems!"

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

Stop, that was a mistake)

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

Very Sad after not seeing Radewoosh in top 10. Hope he will come back...

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

It's my first time to div.1

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

[deleted]

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

good luck mnbvmar in your first round ! hope it will be interesting .

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

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

Is it going to be hard?

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

The Immortal Nutellian's Round !

Problem-set might be interesting !

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

A legendary number of upvotes for any round announcement I guess. Being an LGM pays. :P

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

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

Never expected such an unbalanced round from red coders.

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

The era of non-balanced rounds on codeforces has returned, no-matter who is author

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

is it speed test for div2??

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

Reds:

'You can't improve simply solving Div2As'

Also reds:

Sets contest with 3 Div2As and two Div1 problems

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

Let's face it: most of us just stupid ;)
Seing how many solved Div2D among Div1 I'm thinking that's not such hard problem at all.

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

Solution for D? Does it have something with Binary search?

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

Nice typing speed test

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

Some unbalanced Div2.

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

How to solve Div 1 C :(

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

I’m not a writer, not a tester and I agree that the round was misbalanced. Surprisingly, in the Div. 1 the balance is admissible, but in the second division it is no good. Really, we need more testers from Div. 2. Last time we had so many excellent rating rounds for Div.2 and Div. 3 that I think there is no tragedy today. You see, sometimes it is really difficult to estimate the difficulty. It is a special skill; it is a science to think like others. In a narrow circle of coordinators every time we discuss such incidents and try to make conclusions.

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

    We all are with you.

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

    What's the way to be a tester for Div2 ?

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

    I think that before the round all type of colors should test it ;

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

    2250 looks fair enough, but it would be great to have something to solve in between C and D

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

    I feel people with various ratings should test the problems so as to get an idea on the difficulty. For someone with such high rating, it is obvious for him to feel D easy, hence we should not be blaming the setter. Hence the difficulty thing can only be solved if it is tested by the corresponding color.

    P:S- Just an opinion

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

    The idea of making Div2C = Div1A did wonders when the Div1 cutoff was 1700 — the average skill of Div1 was much lower back then, so it's OK for Div1B to be easy. Right now it's very hard to set a balanced problemset for both divisions this way. The last 5+ Div1+Div2 rounds had either (or both) of them consist of 6 problems, so that the average blue will solve 3-4.

    This round's Div1B was not imbalanced, it's just that Div2 people are too used to have 6 problems, therefore Div1B is supposed to be Div2E. I think it'd be better to just make every Div2 contests have 6 problems, and share 3 problems with Div1 (or even 2, hardly anyone solves Div1C anyway).

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

    In my opinion, the score gap between two problems should be bigger when the score itself is bigger.

    For example, having 500 — 1250 difficulties isn't same as having 1500 — 2250. It doesn't take too much time for a 2250 problem become around 1500 points, while a 1250 problem never becomes less than 500 (unless someone makes a lot of WA submissions). So if one thinks that D1A — D1B should be 500 — 1250, it's likely that D2C — D2D would be more appropriate for 1500 — 3000 or something. With this perspective, we're definitely missing one or two problems between them.

    Also the reason the number of people solved D1A — D1B looks balanced is just because most people in Div. 1 should be good enough to solve 4 problems for Div. 2, and it rather seems that D1B was quite hard for this round because only around half of people in Div. 1 could solve B, which means the other half would've solved only 3 problems if they were Div. 2.

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

    I looking forward to your Div.2 and Div.3.

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

So many people solved the problem B, but others including me and some strong coders couldn't solve it. What important points are we missing?

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

    You are missing a wall.

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

    Let $$$dp(i, j, k)$$$ be shortest prefix of long string such that it contains prefixes of lengths $$$i, j, k$$$ of three strings as disjoint subsequences. $$$dp(i, j, k)$$$ can be easily calculated through $$$dp(i - 1, j, k), dp(i, j - 1, k), dp(i, j, k - 1)$$$ by taking prefix of length $$$dp(i - 1, j, k)$$$ and finding first character after prefix in the long string that is equal to $$$i$$$-th character of first short string. So in each query you have to calculate up to $$$250 \cdot 250$$$ states of dp. I came up with this solution quite quickly but had hard time coding and debugging, so I'm really curious how could someone come up with the solution and code it in around 15 minutes.

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

    Let DP[a][b][c] indicate the shortest prefix of the string we can use to have prefixes of lengths a, b and c from the religions as distinct substrings of it. The DP is trivial to update with DP[a][b][c] = min(DP[a][b][c], next_occ(religion_a[a-1], DP[a-1][b][c])), and similarly for b and c. The DP takes 250^3 memory which fits.

    If we calculate the DP again at every step, we use 250^3 * 1000 time which is too much, but notably the only states that change are those where the last character of the changing string appears (so if we add a character to the end of religion a, then only DP states of the form DP[len(religion_a)][b][c] change), and therefore we only have to do 250^2 work every update. 250^2 * 1000 is fast enough.

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

      Thanks. I missed the sentence "You can assume that no religion will have description longer than 250 characters."

      What the stupid man I am.

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

        Yeah man it'd be much better if there was a notification about this sentence.

        Oh, wait...

        UPD: ok, I switched the language to see what this notification looked like in english. Seems to be a hint for russians lol

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

        Actually this is important only for ML. We solve one query in time proportional to product of lengths of two different strings. Let's assume that we only append symbols, it is easy to show that it is worse for execution time. Then we have numbers A, B, C; one operation does something like A++, TIME += B * C. One can prove by induction that after all operations TIME = A * B * C (cool way is to think about it as building cuboid layer by layer). So, max TIME is $$$(q/3)^3$$$ which is OK.

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

          That's nice. So if it hadn't contained such constraints, it would have been much harder although the essential idea was the same. The conclusion is that I should have solved this problem whether or not I noticed this sentence. Sad

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

            I don't think it would be much harder. You would just need to allocate array with dimensions dp[A][B][C] instead of dp[1000][1000][1000]. You can set A, B and C as number of commands regarding first, second and thrid religion respectively. I wouldn't call that "much harder", but just tedious.

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

              Yes, implementation is tedious, I just thought the value "250" made us easier to come up with the solution because when we see the suspicious value 250, we are always likely to start first thinking about constructing 250*250*250 array(dp) . The solution becomes more explicit.

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

Is D really difficult? Someone please show me how to solve it

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

Very bad distribution of problems!!

There's a very big gap in difficulty between C and D. B,C are very easy compared with other B,C problems, and D,E are very hard compared with other D,E problems!!

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

Balanced contest, thank you

a

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

What is the approach to solve Div 2 c?

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

In div1D, can we do this:

  1. Find all components connected by cheap edges.
  2. Do dijkstra, with a mask indicating which components you have visited. You can't visit the same component multiple times, and cannot take an expensive edge from a component to itself.

This is too slow, but we can just not store components with size 3 or less in the mask, since an optimal path will never visit these components more than once. There are at most 17 components with size 4 or more, and 70 * 2^17 is small enough (9175040).

I did this but got WA at pretest 8 (53527044), rip rating QAQ

EDIT: I think I found the issue. I used indexes of nodes as indexes in one array, but should have used indexes of comps of nodes instead :(

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

Didn't mean to offend。DIV2 is really boring.

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

Несмотря на то, что мои результаты на данном контесте оставляют желать лучшего, я считаю это самым отличным контестом за последнее время. Он собрал в себя редко используемые, и, порой, сложно придумываемые темы. Его обязательно нужно дорешать, чтобы не совершать таких ошибок впредь. То, что задачи были достаточно сложные, нельзя относить к минусам контеста, ведь мы можем развиваться, лишь преодолевая сложности! Огромный респект авторам и координаторам контеста, за то, что они организовали мой досуг на ближайшую неделю!

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

So interesting that in Div1, ~50% of people who solved Div2 C, also solved Div2 D.

But in Div2, only 1% of the people who solved Div2 C also solved Div2 D.

The only way I can explain this is that many people in Div2 saw the numbers and overestimated the difficulty of D. And, being discouraged, they didn't think about the problem hard enough.

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

    I think I disagree with you. Div2C was easier than average, so most if not all Div1 coders solved it. However, Div2D was harder than average Div2D and it's almost Master level (Master and higher > 50% of Div1). So most CM and lower weren't able to solve it.

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

    50% of Div1 people who would have solved Div2 A also solved Div2 D.

    But in Div2, only 1% of the people who solved Div2 A also solved Div2 D.

    The only way I can explain this is that many people in Div2 saw the numbers and overestimated the difficulty of D. And, being discouraged, they didn't think about the problem hard enough.

    Can you point out logical flaw here?

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

    you are right .I even ignore the problem D and start hack work. I think it is necessary to review D again.

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

What was the hack case for Div2A?

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

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

come on , system testing !

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

Extremely unbalanced round. Jump from Div 2 C to D was too great. Now my rating's going to unnecesarily drop :(

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

Especially since I have an extra log factor on B and I'm not sure whether it will pass or not.

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

Div2 B is the same as 389B

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

Oh my god! I realized that Div1.C is not that hard(I think it can be solved with segment tree to solve the maximum value of intervals) after I has given up for 30 min... and the contest was nearly to be over... Anyway, it's a nice problem!

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

Well anyway, R.I.P rating.

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

Я считаю, что участники должны получать от решения задач удовольствия, а не -100 рейтинга и кучу недовольства. Задача D от задачи C отличалась сложностью во много раз.

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

Can anyone tell me the meaning of "disjoint subsequence".

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

People often point out weak tests, so let me do the opposite. I tried various heuristics in div1D and couldn't pass, so kudos to mnbvmar for strong tests.

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

What is wrong output format Unexpected end of file - int32 expected error. I got this error in C and once before as well.

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

    Possibly because for some reasons you printed less integers/tokens than required.

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

      My logic was: First store prime numbers upto 4e5 using Sieve, then iterate over all the prime numbers and take its difference with the previous prime number say dif and check if the difference is odd then try to form dif one 1 and dif/2 2's, if not possible then use all remaining 2's and required number of 1's. If difference is even then try to form dif using 2's only, if not possible then use all 2's and required 1's. For some cases like where count[1]==0, or count[2]==0, or the difference b/w current prime and previous is greater than 2*count[2] + count[1], then use them in any order. Is there any problem in the logic. Link to the code.

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

Congratulations C137

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

So this round didn't skip the users who break the rules?

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

I used https://ideone.com/ to code problem C but I forgot to change it to private and maybe somebody had seen my code and summit it. My code link: https://ideone.com/AIe2YT .

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

This contest kinda goes to show you the problem with having the contest split into two divisions: people from Div2 had higher rating changes than those from Div1 for the same solved problems.

Solving C and D in an hour in the Div2 contest would put you in top 5 and shoot you dirrectly from blue to orange. But solving the same problems them in an hour in Div1 contests only puts you 200-ish, which means purple, maybe low master.

In other words, someone with 1899 solving C and D in an hour would get like +250 rating, but someone with 1900 solving the same problems would only get something like +100. A difference of +150 delta just because of 1 starting rating point.

This situation seems ridiculous to me. In my opinion, if there are going to be shared problems, it"s much better to merge the two contests in a "Rated for everyone" contest. Sure, Div1 people would have to solve two extra "easy" problems, but in general this won't take them more than 10 mimutes.

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

    Isn't what you're describing just a symptom of an unbalanced div2 though? Isn't the core problem the unbalanced div2, not some kind of fundamental flaw in the rating system?

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

    Isn’t the “different rating change for solving the same problems” imbalance present in all rounds where Div1/2 are split? I don’t think it’s unique to this contest.

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

    Shared problems between divisions is not the fundamental issue. Imagine that problems C and D in Div 2 were replaced with new questions of the same difficulty levels. The issue you are describing persists: two nearly identical contestants with ratings 1899 and 1900 can perform similarly on an individual level but earn very different ranks and rating changes.

    I'm not sure it's a big problem, though. There are many factors producing noise in outcomes from any single contest, and it's not like there's any special advantage to entering Div 1 with rating 2149 rather than 2000. In the long run both contestants' ratings should converge appropriately if they are of the same skill level.

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

as for me — really good round (ez Expert:) )