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

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

Всем привет!

В воскресенье состоится всероссийская олимпиада школьников для 5-8 классов имени Келдыша. Удачи всем участникам! Олимпиада проходит под чутким руководством московской методической комиссии в лице GlebsHP, ch_egor, Endagorion, vintage_Vlad_Makeev, Zlobober, meshanya, cdkrot, voidmax, grphil и, конечно, Андреевой Елены Владимировны.

Мы рады представить Codeforces Round #727 на основе задач олимпиады. Это будет Div. 2 раунд, который состоится в 20.06.2021 13:05 (Московское время). Возможно, вы уже и раньше участвовали в раундах на основе олимпиад, подготовленных московской методической коммисией (раунды 327, 342, 345, 376, 401, 433, 441, 466, 469, 507, 516, 541, 545, 567, 583, 594, 622, 626, 657, 680, 704, 707).

Задачи этой олимпиады были придуманы и подготовлены mutant, Siberian, shishyando, Artyom123, TeaTime, Tikhon228 под координацией grphil.

Также спасибо KAN, Aleks5d и isaf27 за помощь с организацией Codeforces версии соревнования и MikeMirzayanov за системы Codeforces и Polygon.

Также хотелось бы поблагодарить компанию Tinkoff и лично Татьяну TKolinkova Колинкову за неоценимый вклад в организацию соревнования.

Желаю удачи!

UPD1: Спасибо _overrated_ и Ormlis за тестирование.

UPD2: Разбалловка: 500 — 750 — 1250 — 1500 — 2000 — 2500

UPD3: Разбор

UPD4: Победители!

Div. 2:

  1. Nilou_
  2. newbiewzs
  3. tou_xue
  4. SoilCrystal
  5. EEIEE

Div. 1 + Div. 2:

  1. Maksim1744
  2. kal013
  3. jiangly
  4. LayCurse
  5. 2qbingxuan
  • Проголосовать: нравится
  • +460
  • Проголосовать: не нравится

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

uh oh, another russian middle school olympiad

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

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

WYSI

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

Dude, what the heck happened here? [I didn't participate in this round]

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

You might have already participated in rounds based on the school olympiads, prepared by Moscow Olympiad Scientific Committee (rounds 327, 342, 345, 376, 401, 433, 441, 466, 469, 507, 516, 541, 545, 567, 583, 594, 622, 626, 657, 680, 704, 707).

Yes, I have and this line, this line.......... terrifies me.

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

Извините за баян, но это шедевр!

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

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

The scariest rounds on CF.

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

Интересно успеют ли участники Келдыша поучаствовать и тут.

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

Don't complain about #707 any more everyone...Maybe cf is thinking about a no-pretest contest at that time

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

Aireu from osu must see this contest.

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

WYSI

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

I am new here can anyone tell what these rounds are like

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

As a setter I hope you will enjoy our problems!

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

is this gonna be tough??

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

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

    LoL how to break this loop bruuhh !!

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

      Solve Problem C, Because you are grey because you can't.

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

      Try to practice more of C and D questions. In total, more than 80% C questions, but 10-20% D questions too, to get more experience in that difficulty rating.

      Even if you can't solve them, try to spend 10-20 minutes trying to observe different details about the problems, that might help in finding its solution.

      Then try to read the editorial 3-4 times, and see if you can solve it. If you can't, try to see the code solution 3-4 times, and see if you understand it. If you don't, go to youtube, and learn how to solve it.

      Try to see the editorial, editorial solution, and multiple youtube solutions, even if you get it right. It's good to learn new tricks and new approaches.

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

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

I remember the last round they organized. It was extremely hard and rating jump from b to c was huge.
But i remember for another reason. I became specialist for first time in that contest. Kinda emotional >.<

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

The last time I saw this much red with numbers was my maths answer sheet in high school.

:Danger:

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

This comment section is surely one of the most funniest ones. Lots of fear, confusion and memes before the contest itself.

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

Round 657 was arguably the hardest round of last year.

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

How many question will be there??

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

Please HELP!!

https://codeforces.me/contest/1534/submission/120000620 why is it showing out of bonds when it is perfectly working in XCODE

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +11 Проголосовать: не нравится
    1. This isn't really the place to post that

    2. You swapped the indices around when initializing your array. It should be string** arr = new string*[a]; and then arr[aa] = new string[b];

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

Hope history doesn't repeat itself ಠ_ಠ Looking forward for interesting but moderate round.

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

aryan57 remember 707?, hehe

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

When you see it!!

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

Does anyone else's latoken rating reduced today after rating returned ?
This round https://codeforces.me/contest/1537/standings

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

hard div 2 :V

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

Notice the unusual timing

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

Give me some positives here, looks like in the contest I'm not getting it!

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

meme

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

Do russian kids know about video games?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +19 Проголосовать: не нравится
I still have nightmares from 657
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится

No scoring distribution for this round!?

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

Score distribution?

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

RIP to my ratings in Advance , I got green in last round.

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

What about score distribution?

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

wonderful writer!!!%%%

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

ch_egor there are less then 25minutes to start. score distribution did not update yet.

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

Wish it be easy:(

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

Here we go again.

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

hope for no googleforces

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

left 3 minutes, hope this time I can be green!

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

WYSI

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

I want an extra registration for this contest sir. Please I didn't know about this timing. I thought it is at 8PM.

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

Huuuuuge gap between D and E,F

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

Again a contest with great problems and a hell lot of cheaters.

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

tourist giving div 2 round very rare

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

Bruh, They either come up with div1 round or div3 round everytime. Give us a round with div2 difficulty variant. :weary:

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

First time solved four questions in any div2 contest :)

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

Hoping the pretests for D are strong.

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

problem A was very annoying , I solved BCD but not A

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

That was educational contest, which is no suprise given the target audience.

For me A was much harder than B, and even harder than C. Also gap from D to E/F felt huge.

But nice problems anyway, thanks a lot.

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

Thanks for the round. I think the problems were good, except A. The sad thing is that the gap between D and E was large.

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

After participating in this round, I QUIT :(

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

speedforces

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

payed back more than what i got in last round.

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

A is the hardest problem among A,B,C,D :))

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

Goddamn A

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

MEET AN EXPRIENCED & SHAMELESS CHEATER This is how Master_Jiraya bypasses Plagiarism testing.

Master_Jiraya does cheating from starting and i reported about it to MikeMirzayanov and he got plag in last round , he abused me in private chat becz i reported him https://ibb.co/JmhSwKL .
guys show your support and again upvote my comment so he again got punished by MikeMirzayanov

People like Master_Jiraya are spoiling the sport. I don't understand where would cheating take them in life. They will never get anywhere in life but always remain what they are i.e cheater. He should be banned from the platform as soon as possible . MikeMirzayanov sir pls ban him and skip his solutions .

his todays contest submission 120093195 120088691 , saw his submission timing and also see this dummy variables snippet
;knock++;knock++;tera++;baap++;aaya++;knock++;knock++;tera++;baap++;aaya++;knock++;knock++;tera++;baap++;aaya++;knock++;knock++;tera++;baap++;aaya++; cur+=to_take;knock++;knock++;tera++;baap++;aaya++;knock++;knock++;tera++;baap++;aaya++;knock++;knock++;tera++;baap++;aaya++;knock++;knock++;tera++;baap++;aaya++; cur+=arr[j].first;knock++;knock++;tera++;baap++;aaya++;knock++;knock++;tera++;baap++;aaya++;knock++;knock++;tera++;

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

Was D easy? I had no idea how to solve D. Can anyone tell what they did

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

Dear problem setters if solution is short doesn't mean the problem is easy and should be A

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

feels like educational round :<

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

Oh dear, I had a stupid mistake in Problem C. For $$$x=1$$$ I treated students with equal levels wrongly (my code increased $$$k$$$ then, since it thought it needs $$$-1$$$ additional students) and I just couldn't find this case. That cost me so many points, it's infuriating! And the points-ranking curve felt quite flat so it hurt even more. :D

But still, I liked the tasks! Looking forward for Editorial E and F.

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

I lost the round because of the unusual time :((((

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

How to solve D? Thanks.

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

    sort the whole pair according to $$$b_i$$$ .
    then from i = 1 to n -> if already taken no of element >= $$$b_i$$$ take $$$a_i$$$ otherwise take $$$b_j$$$ from the last untaken until taken reached $$$b_i$$$. (for this can use two pointer idea.)

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

Can we solve F by finding the maximum values and (n(i)-n(j)) where a[i]>=a[cur] and a[j]<a[cur] in both directions?

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

For problem D :-

AC submission in 1hour 57 min ---> 1800

AC submission in last 3 min ---> 300+

All due to legends like this shivam.utube23
He is one of many others .

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

Problem ABCD is very simple and problem E&F is a bit hard. Over 2000 persons solved D, but few of them solved E.

I think D should be more difficult and E should be a little easier.

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

Was D really that easy?

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

Everything was going fine until I got TLE.

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

Can someone tell why am I getting WA in B 120121669

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

I got destroyed after seeing this was meant for students of grade 5-8...

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

How to solve E?

I was thinking of doing some sort of dp whether its possible to place $$$i$$$-th card in $$$j$$$-th hand. If its possible for $$$(i, j)$$$, binary search on largest $$$x$$$ such that its possible to place only other hand (not j) from $$$(i + 1, x - 1)$$$ (check with pref sums) and $$$k_i$$$ in hand $$$j$$$ is valid in the same range (check with RMQ). Now just mark all $$$(y, j)$$$ as good for all $$$i + 1 \leq y \leq x$$$ using difference sums. I'm still not sure if this is correct as I ran out of time implementing.

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

A was tougher than B.

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

I think in Russia they don't like int they only like long long.

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

Can someone explain what is wrong in my approach for problem D? I am using greedy with prefix and suffix sums. Sort the given 2D array according to products required for discount and then traverse from top and see how many products you can get for a discount.

120081648

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

For problem c, What's wrong in this code?

    vi v;input(v,n);
    sort(v.begin(),v.end());
    ll ans = n;
    for(ll i=1;i<n;i++){
        if((v[i]-v[i-1])<=x)  {
            ans--;
            continue;
        }
        if(k>0){
            if((v[i]-v[i-1])<=2*x){
                ans--;
                k--;
            }
        }
    }
    cout<<ans;
  • »
    »
    5 лет назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    The gap can be greater than 2*x which you haven't considered. Also, there is the case of priority of which gap to close first, which hasn't been taken into account.

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

    You can add multiple students between elements.


    2 2 2 1 7

    Answer is 1, add 3 and 5 to it.

    Even if you remove $$$\leq 2 \times x$$$ condition from your code another problem will appear

    3 1 4
    1 100 108
    
    

    Here its optimal to add the one person between $$$100$$$ and $$$108$$$, whereas your code (with the fix) would try to insert it between $$$1$$$ and $$$100$$$. You need apply the operations in non decreasing order of diffs ($$$v_i - v_{i - 1}$$$) for it to be optimal.

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

    3 2 2

    1 2 8 -->ans : 1 try this

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

    Even when the difference between the two consecutive number is greater than 2*x, in some cases, you can put 2 or more extra numbers between them so that they are connected. However, you have only accounted for the difference lower or equal to 2*x which is incorrect.

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

Also got 4 TLE seemingly just because codeforces doesn't use the latest pypy

It always hurts getting TLE with correct asymptotic and it is even more painful when you know that the problem is not in the language per se or in the code but just in the version the judge uses

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

Anyone tried Top-Down approach for D?

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

Can anyone please help why I am getting a TLE in [problem:727 (Div. 2)-B Love song] 120120431,even though I am having two loops and time complexity is O(n^2) which justifies the constraints as it comes out be 10^12 and we can perform 10^8 operations in one second??If I am calculating time complexity wrong please tell how to calculate it properly as I am facing this problem in many questions

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

Russian Olympiad rounds and Weak Pretests are really Synonyms. Thanks For FST in C , I was accessing Garbage value , I know it's my mistake but then why Pretests passed . :/ .

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

Contest was amazing but Why There is A problem very Annoying :( killed me

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

Why I am getting WA on problem A? Used Approach reverse from second last participant ans = 1 , 2 , 3 .... , (t/x-1) , t/x , t/x , t/x ........

Edit: Got it. t/x can be greater then n.

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

How to solve F? Any hint??

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

    in problem F, we notice one mathematical fact that helps us solve the problem: the distance of the median and the element of any array depends only on $$$nS-nG$$$, where $$$nS$$$ is the number of elements smaller than that element and $$$nG$$$ is the number of elements larger than that. To find the exact expression you should break it into two cases: $$$nS \geq nG$$$ and $$$nS < nG$$$. For $$$nS \geq nG$$$, it comes out to be $$$val = floor((nS-nG)/2)$$$ and for $$$nS < nG$$$ it comes out to be $$$val = floor((nG-nS+1)/2)$$$.

    So you can find subarrays with the maximum value of $$$val$$$ for each of those two cases. For this I implemented two lazy segment trees which output max/min and store prefix sum.

    Then you iterate in descending order and you can maintain in the array that if the value is greater than curr, it is $$$+1$$$ otherwise it is $$$-1$$$. Then prefix sum gives the value of $$$nG-nS$$$ for a prefix.

    120142177

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

Just ban cheaters accounts. It's getting out of control.

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

After sys failing C; Don't believe floating-point arithmetic.

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

So I tried to find the ordering of the products in problem D with exchange argument. However I couldn't is there any proof for the order of products using exchange argument ?

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

    Here's what I can think of:

    Let's say I have to decide the order between two products A and B (where B has a higher required-number-of-prior-purchases-to-unlock-discount value)

    Now I know that no matter what order I go with, I won't be able to purchase B-type products at the discounted price.

    But there CAN exist some order where I can obtain A-type products at a discount. This order will be when I purchase A-type products after purchasing the minimum required B-products to unlock A's discount.

    After that I can buy all A-type products and then buy any remaining B-types.

    To summarize: I will ALWAYS have to spend full price on the objects whose discount-cutoff is high, but there's a chance I can unlock a discount on lower discount-cutoff products. Therefore I should make any full-price purchases on higher discount-cutoff products so I can unlock discounts on lower discount-cutoff products simultaneously.

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

A was really interesting.Mind negetive numbers. And it's my first turn solve many problems in div2 thanks a lot!

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

Why did C not have multiple testcases in each pretest? It has so many FSTs.

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

Most of the code using pypy C is 0.99x seconds, isn't it unreasonable? I still don't know why my code is TLE

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

I think TL on problem C is too tight for Pypy3. Or I was wrong?

(Edit: I got TLE while system testing.)

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

I thought tourist will be streaming for today's contest when he registered.

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

can someone give counter case for pretest 7 of problem D, I tried similar to solution mentioned by others above. Submission

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

Just Python Things :)
»
5 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится -16 Проголосовать: не нравится

Why this gives WA on test 37 in C I didn't expect that :(

cin>>n>>k>>x;
for(int i=0;i<n;i++)
{
    cin>>a[i];
}
sort(a,a+n);
vector<long long>tmp;
for(int i=1;i<n;i++)
{
    if(a[i]-a[i-1]>x)
    tmp.push_back(a[i]-a[i-1]);
}
sort(tmp.begin(),tmp.end());
int si=tmp.size();
si++;
//cout<<si<<endl;

for(int i=0;i<tmp.size();i++)
{
    long long chk=(tmp[i]+2*x-1)/(2*x);
    if(chk<=k)
    k-=chk,si--;
    else break;

}
cout<<si<<endl;



        return 0;
        }

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

It's sad and funny how pretests and 1 sec limit killed most of python solutions. During contest I was happy my C passed and sad cause D didn't. Now, I'm happy D failed, since I have rewritten D in c++ and sad that C passed pretests, since C failed tests :) :( Mood roller-coaster round :)

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

Please give some relief in tightness of time bounds for python users. My O(n) solution for Q. C gave TLE during system testing.

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

    Correct me, if I am wrong, but why do people even try to use Python in CP? If you have even minimal knowledge of languages and how computers/compilers/interpeters work, you should understand that giving Python users higher TL is kind of giving slow cars bonus in time in racing. CP is not all about algorithms only, it is about optimizations of that algorithms as well. So why do you try it using initially unoptimized environment? Of course, it is just my opinion about such comments, feel free to discuss.

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

      It is now an outdated idea, python users are also increasing in this field. You can check the number of python users in other platforms such as Leetcode, binarysearch.io

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

        Well, honestly, I do not think that number of python users is somehow related to this topic. My point is that C/C++ and Python is two different languages for different tasks. If you need productivity and speed — you use C/C++, if you need very cool calculator, or some web-scrapping script, or some ML stuff — you use Python. You won't enter the Formula 1 race with larry truck, because it is for just other purposes. Also you won't submit solutions in C++ on kaggle, or do some scripting stuff with it, etc..

        And also, why do people, who are trying to do CP in Python just TLE'ing almost every contest and then going straight to comment section to blame strict time limits. If you want to get better in CP, use appropiate tools.

        PS. A lot of participants use python to submit A/B problems, where you need some simple not TL related stuff to code fast

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

Please give some relief in tightness of time bounds for python users. My O(n) solution for Q. C gave TLE during system testing.

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

    Hey, a couple of things.

    1. Your solution is actually nlogn, since you are sorting.
    2. My pypy submission also failed on system tests, and it's really sad. Turns out the pypy version that codeforces uses is just really bad with large numbers. So much so, in fact, that the same solution passed comfortably using Python 3.9. I really hope they do something about this.
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +85 Проголосовать: не нравится

I could not understand the statement of problem F during the round. It has many ambiguous points.

I first read maximized value as |i-(center's value)|, |a[i]-(center's value)|, not |(position of a[i] in a subsegment) — (position of center)|.

The statement said "the center" is not the position but the element itself, so the distance compares the position and element's value. I messed up. First sample which has explanation is pretty weak to resolve them.

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

Why do I have TLE? I don't understand.

120075328

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

Feel my pain

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

Short Solutions

Solution A
Solution B
Solution C
Solution D
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Why did python O(N) TLE in C
;-;

Time to reject python embrace c++

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

Problem B was easier than Problem A, the question rating should be B <A.

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

Extremely Sorry for posting this question here, Regarding yesterday's atcoder beginnner contest abc206 F. (https://atcoder.jp/contests/abc206/tasks/abc206_f). I tried to solve it by DP.

This is what I tried.

My understanding for intersecting is, Two intervals A, B are said to intersect if there is atleast one real number x such that x belongs to both A and B. (i.e. intervals which lie completely within each other do intersect).

With this definition, I tried the following logic. First for each position from 1 to 100 note the end positions of the interval starting from that position. Similarly find the minimum end position of all the intervals starting at or after the current position.

Then do a reverse dp (states 0, 1 : 0 -> considering all the intervals starting from >= current position, whether the 1st player can win. 1 -> considering all the intervals starting from current position (only this current position), whether the 1st player can win).

The transition is for all the intervals starting from current position, dp[i][1] = dp[i][1] | !dp[end_position][0]. Then For j from i until the minimum end position -1, dp[i][0] = dp[i][0] | dp[j][1]

https://atcoder.jp/contests/abc206/submissions/23636854

But it does not work. I could not think of a case where it fails. Could somone please suggest a case where it does not work ?

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

Ideone Link: D solution Link Matching submissions which I have found till now: https://codeforces.me/contest/1539/submission/120121120 by Harsh18064, https://codeforces.me/contest/1539/submission/120121447 by dv.jakhar, https://codeforces.me/contest/1539/submission/120121675 by Abhijeet007

There might be many more such submissions which would have copied from the same source. MikeMirzayanov and ch_egor Please have a look at this. I did not want to pollute the CF blog but this type of behaviour must be penalised.

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

greedy forces

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

What is disappointment?

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

For 1539C - Stable Groups, 120068517 (PyPy 3) and 120127418 (Python 3) are exactly the same, however, the PyPy one got TLE while the Python one got AC. Why did this happen?

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

Please try to make pretests stronger. T~T. My Global rank fell from 63 to 1807, because C failed on main tests!

Your text to link here...

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

Pretests for C are too weak. There are no tests with max K. My code passed pretests but failed main tests because I forgot to use long long for k :(

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

To not keep you waiting, the ratings updated preliminarily. We will remove cheaters and update the ratings again soon!

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

I can't believe what I just did The same code that TLE'd in a contest in pypy 3 passed in python 3

python 3

https://codeforces.me/contest/1539/submission/120128958

pypy 3

https://codeforces.me/contest/1539/submission/120107086

CAN ANYONE PLEASE EXPLAIN THIS

TIA

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

The pretests of C is soo weak.

Even in the test cases if you just add 1 participant in every place which has diff > x then it will pass upto test case 24.

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

where's the editorial? grphil

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

editorial please

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

In problem D,Can anyone please explain as to why it would not be optimal to take more than required ai's for any i? Can it not be the case that it would profit us later?

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

    It is not optimal to buy any product more than it is actually required. Consider if you buy an extra item at a discounted price and then by doing this step your total number of bought items reaches a level that you get a discount for buying another item. In this scenario, your total incurred cost would be 1+1=2. Instead of buying this extra item, you can buy the second item at its original price i.e. 2.

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

Pretest of problem C seems very weak (╥╯^╰╥)

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

How to solve E?

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

Where is editorial?

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

For problem C, can someone please explain why the difference between two students' level is supposed to be (a[i+1]-a[i]-1) instead of straightforwardly taking (a[i+1]-a[i]). I can find some of the examples where the formula without minus 1 fails, but I can't find a reason that explains why :(

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

How to solve D using binary search?

The premise was to binary search the number of "Twos" I want such that I try to get as minimum Twos as possible but my checking algorithm isn't correct, any ideas?

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

    I solved with binary search, you can look at my submission

    Well, it got TLE FST because of the pypy issues, but that's a different story

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

    I solved it using binary search as you explained. You do search on number of items, that you will buy without discount (so for price of $$$2$$$). This bases on a simple fact: If you can buy all needed items using only $$$k$$$ purchases without discount, when you always can buy all needed items using $$$k_1 \gt k$$$ purchases without discount. So, the minimal $$$k$$$, such as you can buy all, buying only $$$k$$$ items without discount will yield the solution.

    To check inside binsearch you should firstly sort all items by their $$$b_i$$$, before search. Logic behind it is pretty intuitive, you do not want to spend $$$2$$$ bucks on items, that potentially could be unlocked with discount later, so inside binary search you firstly simulate buying $$$mid$$$ items without discount from the end of sorted list (so, buying the most hard-to-unlick items). Then you basically go from the beggining of this list, and check that for items you need and did not buy yet for 2 bucks, you have discount. If you can buy all needed items with only $$$mid$$$ undiscounted purchases, then do $$$r := mid$$$, searching for more optimal solution, else do $$$l := mid + 1$$$. After binsearch answer is $$$2 * k + ((\sum a_i) - k)$$$. Submission: 120089991

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

https://www.youtube.com/channel/UCm-7dkk1fHId1hy5vY5VVCQ this guy is spreading live solutions.plz take serious actions

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

I solved D in O(n) using MITM technique. You can check it out: https://codeforces.me/contest/1539/submission/120088638

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

Can someone please explain this to me this is the solution I had submitted for problem D during the contest and it gave TLE but after the contest I submitted the same solution with a small change in the compare function and it worked Same solution for D with change in compare function

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится
PROBLEM A LOOKING AT QUESTION B,C,D TODAY (JUST FOR FUN)

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

CF-DIV2D shinigami676 kriborz Mnltrix vineet_02 akki_592_148 gsamarth882 Adarsh_29 Harsh18064 there are some users 100% cheat in this contest and almost are India. Pls check and give them heavy penalty.

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

Its my humble request to the cheaters please don't ruin the Codeforces contests by cheating , if you really want to improve do the hard work and trust me efforts never go in vain someday or the other you gonna get what you have worked for.

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

Can someone help me out with F? I tried using segment trees. The idea basically is that in a given subsegement for a particular x what matters is the number: No. of elements greater than x — No. of elements less than x. this will be the sum over that subsegment if I represent a number greater than x as 1 and -1 otherwise(it get's a little more complicated when you consider equal elements but the idea is same). The code seems to be working correctly, except the fact that I am getting TLE. And given that I just do 2*n updates and 4*n queries in total I don't understand why it is so. Here's my code

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

Why you have not published the editorial till now ch_egor?

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

А вот и разбор. https://drive.google.com/file/d/1jLyZYqJggeXPateMQdXNtEG3IXiAnw4n/view https://drive.google.com/file/d/1SQou7jQL2UlTPYh0xNDJU5CEtIDKTN5v/view текстовый разбор на сайте олимпиады

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

Waiting for editorial. Have been waiting for 5 hours already. Where. is. editorial.

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

Me, waiting for editorial

........

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

Speedforces.

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

Test:

5
3 10
2 12
1 11
3 10
1 8

Submission: Your text to link here...

Output : 20 Correct Output: 19

This submission is getting accepted but however the above test case shows wrong output. Correct Output should be 19, instead of 20.

mutant

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

Why I am getting runtime error?Anyone please tell.

My submission.

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

Anyone has any idea if the contest has been officially deemed unrated or there's an issue with the rating? I don't see any posts about this round going unrated, and it's the first time I'd touched the Specialist tag so I really really want the round to stay rated.

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

Harsh18064 this user was cheated why he still rated ? MikeMirzayanov check this

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

getting tle in 'C' in testcase 61 using java, the same code works well in c++