Автор awoo, история, 4 года назад, По-русски

Привет, Codeforces!

В Jul/08/2022 17:35 (Moscow time) состоится Educational Codeforces Round 131 (Rated for Div. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

Также от наших друзей и партнёров из Harbour.Space есть сообщение для вас: Harbour.Space

Привет, Codeforces!

Добро пожаловать на 131-й образовательный раунд, организованный Harbour.Space и Codeforces.

Довольно впечатляюще, не так ли? А теперь настало время погрузиться глубже в мир спортивного программирования с 10-дневным интенсивным летним лагерем, который организован Harbour.Space и Leagues of Code.

Не забудьте о скидках на участие в нашем летнем лагере. Каждый участник сообщества Codeforces получит скидку 30% на участие на месте или скидку 50% на участие онлайн по промокоду CFLOC2022.

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

Мы приглашаем студентов в возрасте от 10 до 24 лет, заинтересованных в улучшении своих навыков или желающих пройти интенсивную подготовку высокого уровня перед IOI. Преподавателями в лагере будут серебряный медалист ICPC World Final 244mhq, победитель SWERC 2022 MaksymOboznyi, чемпион ICPC World Final pashka и другие. Участники будут разделены на классы в зависимости от их уровня и предыдущего опыта. Занятия будут проходить на английском языке.

Узнать больше →

Harbour.Space

Удачи в раунде!

UPD: Разбор опубликован

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

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится -38 Проголосовать: не нравится
Don't open
»
4 года назад, скрыть # |
 
Проголосовать: нравится +81 Проголосовать: не нравится

 ****

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

say something irrelevant: what happened to the last div2? my little ratings is missing. hope i can get them back in this round. TAT

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

I shook hands with almost all grandmasters in the blog and all candidates

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

excited for my first round

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

I know about the A problem and I am gonna reveal it I am 100% sure it would be of xor :|

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

.

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

What’s up with people commenting about Div 2A being a xor problem? Do people hate bitwise operation problems? I always thought problems about bitwise operations are possibly one of the most versatile topics, from basic observation problems all the way up to like FWHT, and one should definitely practice them and for most “easy” problems, the most you have to do is knowing the basic properties+considering each bit separately. Lmk if you disagree

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

high HOPES with this round

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

can anyone guess the rating level of 3rd problem in today's contest?

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

spermutation forces

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

Everything is correct with my code for problem C, but I'm getting WA on test case 2

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

Good round, interesting tasks. Although i'm too weak to solve most of them during the contest.

Thanks for the round, thanks for Codeforces.

Waiting for the result and rating change... (I'm so unwilling to receive such a low rank...)

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

God, how much more time will it take to reach Cyan?

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

Overall, a balanced educational round

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

Hmm, D doesn't budge for me :D.

Any tips? Only thing I've realized is that we always know where 1 is but other than that it may depend :<

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

    If $$$\lfloor \dfrac{i}{a_i} \rfloor$$$ is equal to $$$b_i$$$, it means that $$$a_i$$$ should be in some segment of integers. For each $$$i$$$, generate this segment, and then match each value from $$$1$$$ to $$$n$$$ with a segment greedily.

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

    Looking at the solves, probably my solution is way too complicated and there is something simpler..

    First decompose each element into the ranges it can exist if the answer is k (which is i+1 to n if it is 0, i/(k+1) + 1 to i/k otherwise).

    Keep these ranges grouped by starting position (and also sort by length). Now, for the i'th turn do the following

    1: Add the smallest range by length from the i'th group (i.e. all ranges that are of the form [i,?]) to your processing group. 2. Remove the smallest range from your processing group. Place the index of this range at position i 3. Whichever group the range you just removed was from, add it's smallest range to your processing group.

    Submission:

    163296621

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

In D we can calculate foreach position a minimum and a maximum value, consider them to be segments. Then sort these segments by the min value.

Iterate all numbers i from 1 to n, and foreach number collect all segments with $$$min \lt =i$$$. From these collected segments choose the one with minimal max value, and mark that segment as used.

It took me ages to get the formulars for min and max by trial and error. How is this done correctly in time?

$$$min=((i+1)/(b[i]+1)+1$$$ ???

$$$max=(i+1)/b[i]$$$ for b[i]>0 ???

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

Is greedily giving tasks to workers with no task right approach for C?

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

    Advanced Binary Search (like Book Allocation Problem) will do for C.

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

      How did you conclude it is solvable by binary search? I could only think in the greedy direction

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

        good job, the tags are: binary search,greedy. you have to apply the binary search algorithm to find the minimum hours needed. for example if 100 hour is enough so what about 50? not enough? ok maybe 75 will be enough. every time you change your range you have to check: can the first worker finish his favourite missions in (mid) hours? if he can finish so he can also work on some other mission that will take 2 hours so the first worker will do: fav + (mid-fav)/2. if he cannot finish in (mid) hours he can only work on: (mid) missions. and you have to do this for every worker with a for loop (or a while loop) if the total sum of the missions that the workers can do is greater or equal to (m) then the time you choose is a good answer, save the answer and move to a smaller range, but if it is strictly smaller than (m) it is not valid and you need a bigger (mid). :)

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

        we can just notice that if we can finish all the tasks in x days, we can finish them in x + y (y > 0) days as well, and at opposite: if we cant finish in x days, we cant finish in x — y days as well. and it's direct hint for binary search (but i confess i was thinking about greedy solution for about half an hour...)

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

    Binary Search Approach will work

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

    it's not too easy to implement — eg i was thinking about it for a half an hour, then i just wrote binsearch, which was really easier than the greedy solution

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

    Assign all 1-tasks to the workers, maintain the assigned tasks per worker in a list.

    Also maintain the last finish time of each worker in a queue, or sorted set.

    Then take first/earliest worker and last/latest worker from the queue, and asign a task from the latest to the earliest, put both again with the updated values onto the queue.

    Repeat until first and last differs by at most 2.

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

    Just assign all workers to tasks they can do with max efficiency.

    Now place them all in set. As long as largest element and smallest in set differ by >=3

    Reduce 1 from your largest element

    add 2 to your smallest element

    (you're simulating giving a task from one worker to another)

    In the end output the largest element in set

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

    If you have a multiset of workers' task durations, repeat the following until the min duration >= max duration - 2: subtract one hour from the highest duration, add two hours to the lowest.

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

      In your solution for C, why did you delete the lower bound of lo and hi instead of deleting lo and hi itself?

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

        To be completely honest, it’s because I’m not very good with multisets so I do the safest possible thing. I only really took up C++ last year and before that I used Python, so my skills have a long way to go.

        The specific reason is that in the past I’ve made errors by accidentally deleting multiple instances, or the wrong iterator, and I know for sure that lower_bound is safe. One day I will bother to learn how everything works properly.

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

I am really confused. When solving c with binary search r=1e18 I got wrong answer, but with r=2e5 it was accepted (?_?)

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

Why couldn't the memory limit for E be 512 MB? I think my solution would have passed 163297562. I didn't have the time to make optimizations :(

Still thanks for the round.

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

    Oh, I'm really sorry about that. I thought to make it 512MB but when I was calculating something like "5000^2 integers", I found that it is only about 100MB, so I decided that even two such matrices will fit and I decided to keep the memory limit as it is. :(

    UPD: Though, I just replaced all int matrices with short matrices, and your solution passed with 157MB peak memory used. I'm not blaming you, just informing that you could do something like that in the future. Because, for example, in this problem you couldn't meet any numbers greater than $$$O(n)$$$, so short is more than enough.

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

Why is this approach incorrect for D?

Every index i is satisfied by a range of values: [ (i+1)/(a[i]+1), i/a[i] ]. Now I sort the ranges increasing based on their left boundary. Now in these ranges, every value from 1 to N is covered atleast once, because it's given that the answer is always possible. Now I greedily give values 1 to N to the respective indices of these ranges in sorted order. I feel intuitively that this should work but it doesn't.

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

Fuck you and your shit harbour space, this is a disgusting contest. downvoted

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

What can be the difficulty rating of C?

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

Can anyone give me a hint on C ... like what I can try on that ??

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

Too standard and FUCKING STUPID F, a *1400 problem put in the position of F.

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

Too standard and FUCKING STUPID problem F. How can this *1400 problem be put in the position of F??????

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

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

I read both A's and B's statements incorrecty, and both of my solutions for wrong problems passed 1st tests :((((((

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

Can anyone give a small testcase on which my submission gives wrong answer. This is my submission. 163284420

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

i have a question with problem C

from this code 163304299, i had a integer flow. so i change all int to long long like this 163303533, then i got correct.

plz tell me why...

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

Why My solution for question C keep on giving wrong answer answer on test 2 I am using binary search https://codeforces.me/contest/1701/submission/163306213

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

Problem C. Hello, can not imagine counter example for this approach, can you please help? Thanks.

Why does this idea on a problem C is wrong?
»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Спасибо за контест

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

https://codeforces.me/contest/1701/submission/163296776 Can you please help me find an example where this greedy solution does not work?

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

Hi Guys, What could possibly be wrong with my Problem C submission https://codeforces.me/contest/1701/submission/163308184

My approach is very greedy, but it seems to work.

Is there a way to get the buggy test case? Any kind soul help this poor fellow here please.

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

Anyone Solved Problem C using Priority Queue? My solution is passing most of the tc. Anyone understanding the problem with my code please help Solution Link: https://codeforces.me/contest/1701/submission/163305827

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

    https://codeforces.me/contest/1701/submission/163281220 Here is my shitty but AC for now solution. Binary search is probably easier but I still can't solve any binary search problems that aren't leetcode easy so it never occurred to me during the contest(should probably start practicing it lol) plus I am addicted to using priority queue. I saw some people use multiset though which also seems way easier. I initially tried multiset but switched to priority queue. It is not the multiset fault though, I just had wrong idea at the time. I also don't know how to analyze algorithms but I am pretty sure my solution is $$$O(n \cdot \text{log} N)$$$ which is fine for 200000. Hopefully I don't get hacked lol.

    **Update : ** I resubmitted my solution with comments and removed some extraneous code which should make it clear what the code is doing.https://codeforces.me/contest/1701/submission/163322218

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

I made video Solutions for A-D in case someone is interested.

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

Can anyone point me to more problems like D that I can practice? It would be a great help. _Wizard_King_ mentioned in the comments "It is simple sweepline". Where can I practice more of such problems. (thanks)

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

I coincidentally did 1348F - Phoenix and Memory a few days ago, which had the same idea as problem D of this round.

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

Instead of gaining 100+ points, I'm going to lose 50 points because I forgot about longs on question c, sad day for me.

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

Can someone point out what's wrong with my submission. Failing on TestCase 3. https://codeforces.me/contest/1701/submission/163279323

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

What a pity. I could have made a D

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

Will we get rating for this contest

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

Standings for individual divisions are broken: Division 1, Division 2

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

When will the editorial be available?

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

Очень похоже на спидфорсес. Слишком большой разрыв между C и D. Я, человек который сдал 3 задачи со штрафом 145, на 4000 месте, а человек, который сдал тоже 3 задачи, но со штрафом 40, на 1000.

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

I don't seem to understand the time limit for F because there's a normal $$$O(Q \log M)$$$ solution using a lazy segment tree

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

Очень хорошая задача F. Вот бы такие задачи были почаще...

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

Any hints for problem E?

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

Your text to link here...

This is my solution for problem C. I don't know why but this gave TLE on system test case 15. But after the contest, I submitted the exact same code and it got Accepted. Can anybody please confirm by submitting the same code in CPP 17?

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

Sorry for my impatience, could anyone explain me the solution to problem E?

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

Please tell me how the problem F is solved.

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

Когда выйдет редакционная статья?

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

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

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

I couldn't register for the camp on time, is there another camp anytime soon?