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

Привет, Codeforces!

В 18.12.2021 18:35 (Московское время) состоится Educational Codeforces Round 119 (рейтинговый для Div. 2). Пожалуйста, обратите внимание на необычное время старта.

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

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

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

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

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

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

Codeforces and Harbour.Space

Привет, Codeforces!

Почти 5 месяцев прошло с тех пор как мы организовали Harbour.Space Scholarship Contest 2021-2022. Это был довольно сложный вызов для более чем 15 000 человек, принявших участие в раунде. Однако мы смогли отобрать тех, кто был готов воспользоваться возможностью и присоединиться к Harbour.Space в этом году. Помимо этого мы внимательно рассмотрели все заявки на стипендии и наградили в общей сложности 11 студентов.

Мы хотели бы представить вам наших обладателей стипендии, которые уже прибыли в Барселону:

aniervs, MaksymOboznyi, 244mhq, Meijer, bthero,amanbol, DimmyT, 998batrr

Мы с нетерпением ожидаем достижения невероятных высот нашими новыми командами ICPC. Одна из них, Harbour.Backspace (MaksymOboznyi, 244mhq, 998batrr), уже занял З-е место в Moscow Workshops. Желаем им всего наилучшего во всех предстоящих раундах.

Codeforces and Harbour.Space

Как и всегда мы будем очень рады видеть участников сообщества Codeforces как наших студентов здесь в Harbour.Space.

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

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

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

Excited for the contest, Wishing everyone high ratings in last Educational Round of 2021.

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

forward Kazakhstan

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

Always love educational round.

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

Please, note the unusual start time.
ok at this point I got lost, what's the actual usual time!?

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

unusual unusual time(you know,usual unusual time means before 17:35)

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

The start time in China is too unusual!

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

Shouldn't it be BYE BYE educational 2021 XD...

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

cheaters who registered in this round: nitin_05 ashokesen02

  1. will they cheat again in this round?
  2. if so, will they not be caught and be rated again?!
  3. who will cheat better and drain more ratings from other innocent users?!?
  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится +21 Проголосовать: не нравится

    Why you just keep on posting same thing again and again in every contest's announcement.My advice to you is not to focus on others whether they are cheating or not rather you should practice more and more to surpass those cheaters. And for cheaters they can become expert or CM by cheating but ratings without having knowledge is of no use they can't use it anywhere be it in Online tests,interviews.

    So just focus on developing skill and you can see positive outcomes after sometime :D.

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

SIUUU

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

Wasn't this time the usual one now it became unusual

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

Why so negative?

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

I hope this round will be excellent! (as usual <3)

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

Hope this time my rating will increase and my contribution rating will not go more negative.

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

C should not exist

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

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

I m not able to understand the 3rd test case of the C problem we can at max replace all '*' with 'bbb' and then also the rank will be 16 but it is asking for 20? Help me understand it. Be merciful on me.

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

    If I am not wrong for the third test case of C 6 3 20 **a*** output -- babbbbbbbbb The strings are --

    - a
    - ab
    - abb
    - abbb
    - abbbb
    - abbbbb
    - abbbbbb
    - abbbbbbb
    - abbbbbbbb
    - abbbbbbbbb
    - ba
    - bab
    - babb
    - babbb
    - babbbb
    - babbbbb
    - babbbbbb
    - babbbbbbb
    - babbbbbbbb
    - babbbbbbbbb
    

    btw was not able to solve it.. RIP

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

    The number of possibilities is not 16. In the first group of asterisks, we can have at most 6 'b'. In the second group of asterisks, we can have at most 9 'b'. So, the total number of possibilities is (6 + 1) * (9 + 1) = 70.

    You can fix the first group of asterisks with some number of 'b'. Then, you can have 10 different strings as you can adjust the number of 'b' in the second group of asterisks.

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

C is in a difference lever :v

»
4 года назад, скрыть # |
 
Проголосовать: нравится +21 Проголосовать: не нравится
Back at it again :')
»
4 года назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Please any one give me a hint to solve E ??

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

I didn't have time but I think problem G can be solved using inclusion-exclusion for each mask of subsequence [where the value of each mask represents the number of strings which are subsequences of all strings which have bit set in the mask]. Is it the right idea?

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

Can E be solved with some modification to dsu?

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

Can I improve my delta by hacking someone else's solution?

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

I eagerly wait to know the author of problem D

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

I didn't get AC for B until there was exactly 1 minute left because I used int instead of long

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

    The attempt was so blatant lol, Dude commented the block of code and then wrote the same code and thought that he wouldn't be caught by the CF plag system.

    The first thing any plag tool does is to wipe off all the comments, spaces and indents and read the code as one single line.

    How dumb can one be.

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

Was I the only one who found E much easier than both C and D.

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

12 wrong submissoins on C. I just want to die

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

My approach for Problem E: Replace the Numbers

The idea is pretty similar to 365A: Knight Tournament

Suppose an element $$$x$$$ is appended to the end of the array at the $$$j^{th}$$$ query. We can make the following 2 observations:

  1. The final value of this element would not depend on any Type-1 or Type-2 query strictly to the left of the $$$j^{th}$$$ query.
  2. If we have two Type-2 queries strictly to the right of the $$$j^{th}$$$ query, say at indices $$$k_1$$$ and $$$k_2$$$, (such that $$$k_1 \lt k_2$$$), and they both operate on $$$x$$$, i.e they both instruct to change the value of $$$x$$$ to $$$y$$$ or $$$z$$$ respectively, then the first query takes precedence.

So, if we process the queries in reverse order, then by the time we reached the $$$j^{th}$$$ query (counting from zero), we would have all the information to restore the value of $$$x$$$, if we keep overwriting the values of $$$x$$$ in case of overlapping Type-2 queries.

So, if we define $$$sink[x]$$$ as the value that $$$x$$$ should be currently converted to, we can process the queries as follows:

  • Type-1 Queries: Just append $$$sink[x]$$$ to the result.
  • Type-2 Queries: Update $$$sink[x] = sink[y]$$$.

Finally, reverse the $$$result$$$ vector.

Implementation

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

How to solve E?? is there any way to pass test case 5??

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

I took more than an hour to solve C but only 7 minutes for E.

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

I think many people passed G with $$$O(26*n*2^{n})$$$, but it wasn't intended right?

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

Getting ready for a -100 LOL :p

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

I don't understand the gap

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

I don't understand the gap

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

I'm curious what's test 2 here that's causing WA.

https://pastebin.com/41BJXM9H

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

how to solve A?

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

Why so tight constraints! :/

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

solved D after contest ended 3min :D

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

No greedy,that I cannot solve any problems.

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

One Doubt , I submitted 1st Accepted Solution to C at 1:08 and second at 1:18 if the first one gets hacked or FST , the second one's final verdict will decide my rank ?

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

    Because your complexity is not good?

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

      can you tell me what is the time complexity link of this solution, according to the constraints shouldn't this give solution gives tle?

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

        It's $$$O(q \log q)$$$.

        It uses small-to-large merging, unlike the person I replied to. Basically this line is very important: if (y.size() > z.size()). It can sound unintuitive but in total, every element gets copied from one vector to another only $$$O(\log q)$$$ times (it's similar in the idea to HLD and union-by-size in DSU).

        Proof sketch

        So in total it's $$$O(q \log q)$$$. Also y.swap(z) takes constant time (I didn't know this) so no worries there.

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

Really hard test case 3 in problem C for my small brain :(

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

WORST round EVER!

Emplemetionforces and speedforces combined

bruh

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

I didn't get D... Somebody please explain the third and fourth case

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

C has an overflow issue.. I got too many WAs because of overflow issue

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

D drove me mad...qwq

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

Why my solution got Memory Limit error? I couldn't see what is the problem. https://mirror.codeforces.com/contest/1620/submission/139812356

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

very cool problems! managed to solve A,B and C, and it somehow felt like A stumped me the most. thank you for a good round.

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

I'm surprised nobody mentioned a solution using DSU for E yet. It's the first thing I thought of, could there be something wrong?

  • Initialize DSU to size equal to number of final array elements.
  • Maintain two mappings: (DSU leader -> value) and (value -> DSU leader)
  • Processing the queries seems straightforward..? The only things to be wary of are that when you need to merge values, the DSU leader of a component may change, and you need to make sure that only leaders are present in the mappings.
  • In the end, the value for index i, processed in increasing order, is the value of its leader.
»
4 года назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

I think D and E should have been swapped. E was as simple as simulating the process backwards.

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

Is there an etalon solution for problem E in Python3? My solution is O(n) but it exceeds time either on test 13 or sometimes on test 17 sometimes, even with fast IO

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

    Tried it in Python first too, got 2 TLEs, wrote the same code in C++, got AC.

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

    There is a lot — check out submission stats for a problem — and you can just switch to pypy3 sometimes it helps.  is yours code AC in pypy3.

    PS. And to add: you are creating a lot of objects (lists) to encode input. Try to simplify it and get rid of them.

    P.P.S. Or maybe not and I am wrong (about creating a lot of objects) — cause your solution is faster than my when I run it on PyPy :)

    PPPS. Oh, no, I was right, but you have reall-really-really good "fast-input". My solution become twice faster with it — thank you very much!

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

Why is my code for C TLEing? 139829242

I think my complexity is O(n*k), where n<=2000, k<=2000

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

This "hack" is borderline hilarious.

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

C >> D

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

I don't know if the intended time complexity of the solution for D is $$$\mathcal{O}(N)$$$, but checking only 7 possible patterns for cost of each bag receives AC verdict.

The patterns are:

Can anyone hack this solution? Submission:

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

Can anybody tell what I am doing wrong in C. solution link — c

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

Can someone explain why my memory limit is exceeding in my solution for C 139817111

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

How to solve problem F?

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

I passed C after the contest when i used unsigned long long rather than long long. Codeforces doesnt support cry emojis

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

Thank you, too good to goodbye for 2021.

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

Am I the only one who found C much easier than D and E?

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

Why are contestants with ratings greater than 2100 being shown as official participants? will they be removed from the official list and then acc. our rating change will be calculated?

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

E can be simply solved by small to big technique. just merge. here is my submission 139852514

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

The Rating Result?

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

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

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

looks like problem A was the only problem nitin_05 could solve without buying solutions. XD

he got skipped except A

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

    That problem not being skipped has worked to his disadvantage.

    If all the solutions would have been skipped then he would have no valid submission and the round would become unrated for him. However the solution for problem A not skipping means that the round is rated for him and due to only 1 correct submission , there's a huge negative delta.

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

Hello

I was suspected to cheat on the problem A with Shanto65 and atau004.

As you can see in this problem, it is very probable the everyone use this idea(and use a variable called cnt).

Dear codeforces please review this again(by the way i didnt use ideone or something like that).

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

Fake Plagiarism check to ban me from my own account. TheThinker_08. This has now happened several times. What you cant even write your own code now. And The other guy @Paul_Liao_1457 got no penalty just cause his score is greater than mine. please just look into this I didn't do anything wrong or copy from anywhere still got a plagiarism check and got banned just what is this

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

I have a question about E. in my opinion i have O(n) solution, but it gets TL at 5th test, can someone tell me what's wrong? Is it solution or it's just Python can't make it.

https://mirror.codeforces.com/contest/1620/submission/139826532