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

Привет, Codeforces!

В Aug/17/2023 17:35 (Moscow time) состоится Educational Codeforces Round 153 (Rated for Div. 2).

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

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

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

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

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

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

Harbour.Space
НОВАЯ ВОЗМОЖНОСТЬ ОБУЧЕНИЯ И РАБОТЫ В БАРСЕЛОНЕ @HARBOUR.SPACE UNIVERSITY

Harbour.Space University в партнерстве с Giga (Unicef) предлагают стипендию для получения степени магистра в сфере Computer Science and Front-end Development, а так же опыт работы.

Мы ищем различных кандидатов от junior до mid уровня:

Front-end разработчик:

Студенту на этой позиции придется тесно сотрудничать с разработчиком блокчейна и главным менеджером по продукту чтобы способствовать разработке и реализации пользовательских интерфейсов для прототипов компании на основе блокчейна. Они будут отвечать за перевод каркасных фреймов UI/UX в функциональные и визуально привлекательные веб-приложения, обеспечивая беспрепятственный пользовательский опыт. Студент будет сотрудничать с блокчейн и бэкенд разработчиками и дизайнерами для оптимизации производительности приложения. Они также будут участвовать в тестировании, отладке и поддержании базы исходных кодов. У стажера будет возможность получить практический опыт разработки интерфейса в контексте технологии блокчейна и внести свой вклад в миссию Giga по подключению школ к Интернету.

  • Уверенное понимание HTML, CSS и JavaScript
  • Знакомство с фронтэнд фреймворками и инструментами, такими как React или Vue.js.
  • Навык решения задач, внимание к деталям и страсть к созданию интуитивно понятных пользовательских интерфейсов имеют важное значение

Full Stack разработчик:

  • Интерес и опыт в разработке веб-приложений, информационных продуктов и OpenAPI
  • Умение работать с облачными службами развертывания (предпочтительно Azure), конвейером Git и CI/CD, а также процессами развертывания.
  • Приветствуется опыт работы с проектами с открытым исходным кодом
  • Уверенное знание ML
  • Опыт работы с инструментами визуализации данных, такими как matplotlib, ggplot, d3.js, Tableau
  • Отличные коммуникативные навыки — невероятно важно описывать результаты для технической и нетехнической аудитории
  • Большой опыт разработки программного обеспечения
  • Практический опыт работы с инструментами обработки данных
  • Способность решать задачи
  • Аналитический склад ума и отличное деловое чутье
  • Степень в области компьютерных наук, инженерии или смежной области приветствуется

Все успешные кандидаты будут иметь право на получение стипендии со стопроцентной оплатой обучения (29 900 евро в год), предоставляемой нашими партнерами.

ОБЯЗАТЕЛЬСТВА КАНДИДАТА

Обучение: 3 часа в день

За год обучения вы завершите 15 модулей (длительность каждого 3 недели). Ежедневная учебная нагрузка составляет 3 часа, плюс домашнее задание, которое нужно выполнить в свободное время.

Работа: 4 часа в день

Погрузитесь в профессиональный мир во время обучения. Вы будете учиться у лучших и с первого дня сможете применять свои новые знания на практике.

ТРЕБОВАНИЯ

  • Опыт работы в отрасли
  • Международная экспозиция
  • Стремление к обучению
  • Устойчивое развитие ключевой момент для вас
  • Желание работать на общественную организацию
Подать заявку →

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

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

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

Hope the round will be interesting

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

..

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

It will be very good, if educational rounds also have scoring distribution of problems!

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

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

Wow, hope a good round!

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

awoo uwu ><

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

Hope to reach pupil this round! Just 7 more points to go :O

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

Good luck, everyone! I hope there'll be good and pleasant problems at this contest

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

I LOVE EDU ROUNDS :3

PS: Earned +87 delta woooo!

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

I will drunk drive if I don't get positive rating in this round

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

Imagine the C problem is another permutation problem:)

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

Hope to reach Pupil.

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

holp to reach specailist

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

Hope it will be an interesting round!

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

This round is so weird. Also A>>B and A>>C.

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

I will try to give constructive criticism this time.

Please, find testers or at least proof readers for your problem statements.

  • B is very hard to understand. What does an infinite number of stones mean? What is a1/ak

  • C is very weird. Alice makes the first move, but the first move isn't part of the game? How does that make sense?

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

Cool C,D,E but terrible A,B imo.

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

The Pain is real T_T

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

how to solve C?

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

    It is easy to notice that the chip will be moving along the LIS ending at the i-th element. If the length of the LIS ending at the i-th element is 2, the i-th element is lucky, otherwise Bob can always make himself win. 219331114

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

      My solution is pretty much the same as dIsPoSEdOfFAcCC514's, but i managed to simplify the implementation a bit more IMO, turns out we just need to keep track of the minimums, that is the minimum of the whole array, and the minimum of the winning positions values. The next winning position's value will need to be between the minimum of the whole array and the minimum of the winning positions values. Also, CMIIW 219313622

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

    Let’s define cnt(pi) as count of elements lesser than pi that comes before it when going from left to right.

    Alice can choose an index i if all pj<pi for j<i cnt (pj)=0.

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

    Let $$$d_i = -1$$$ for all $$$i$$$. Now denote $$$d_i = 1$$$, if $$$i-th$$$ element is good, otherwise $$$d_i = 0$$$.

    We go from $$$0$$$ to $$$n - 1$$$. It's obvious, that if we now have $$$d_i = -1$$$, then it's gonna be $$$1$$$ if we have no $$$a_j$$$, such that $$$j \lt i$$$ and $$$a_j \lt a_i$$$ and $$$d_j = 1$$$, otherwise $$$0$$$. So we just keep $$$2$$$ minimum elements. One with $$$d_i = 0$$$ and one with $$$d_i = 1$$$ and compare $$$a_i$$$ with each of them. After this update minimums.

    Answer is $$$sum(d)$$$.

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

    I solved that in O(n) Time complexity (One scan to be exact) and O(1) Space Complexity (No need to make an array).

    So we declare two int variables as minLucky (the minimum lucky element until the ith element) and Min (the minimum element till ith element) and initialize them both as INT_MAX. Also, initialize a variable lucky = 0 (this stores the number of lucky elements).

    We run n iterations and in each one, input a number (say x) of the permutation and do the following: (1) if x is greater than minLucky, ignore and continue; (2) if x is smaller than Min, update Min = x; continue; (3) if x is greater than Min and smaller than minLucky, then x surely is a lucky element, so increment lucky and minLucky = x (of course x was less than minLucky to reach condition (3))

    Finally output lucky and there we go. You can find my code here.

    Note: I came up with this solution on my own, although after the contest ended. Also have NOT been able to mathematically prove the working yet. I just took many different test cases and made observations to reach this approach.

    PS: This is my first comment/post on this site. English is not my first language

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

I think making problems hard to understand is becoming a trend or something like that

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

After being specialist for so many contests, I solved 0 and dropped to pupil, go next contest I guess

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

2 hours' time may be too tight to view all of the problems.

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

A was really hard. I feel that among A,B,C, C was the easiest of the three.

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

For D, I wonder what the upperbound for the minimum number of swaps needed is. It seems to be very low. I thought it was 2 or 3, but it seems I am wrong.

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

how to solve E

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

Problem C Can someone please explain how answer should be 1. n = 4 , a = 1 2 3 4

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

Just to make sure my A doesn't fail, can someone verify this logic:

If string is "()" it is impossible.

If string is alternating for example: ")()()()" then you can use "(((...)))"

Otherwise you can use "()()()()()..."

Here is the code.

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

    Yep, basically if $$$s$$$ doesn't occur in $$$(((...)))$$$ then it's an answer, otherwise if $$$s$$$ doesn't occur in $$$()()...()()$$$ then it's an answer, otherwise there is no answer.

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

      I was thinking along the same line but could not prove to myself why it works. Can you tell why this works in some mathematical proof ?

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

        Basically, we can prove by induction:

        Let see if $$$|s| = 3$$$:

        1. $$$((($$$ — $$$()()()$$$ is suffice.

        2. $$$(()$$$ — $$$()()()$$$ is suffice.

        3. $$$()($$$ — $$$((()))$$$ is suffice.

        4. $$$())$$$ — $$$()()()$$$ is suffice.

        5. $$$)(($$$ — $$$()()()$$$ is suffice.

        6. $$$)()$$$ — $$$((()))$$$ is suffice.

        7. $$$))($$$ — $$$()()()$$$ is suffice.

        8. $$$)))$$$ — $$$()()()$$$ is suffice.

        If $$$|s| \gt 3$$$ then it will have $$$1$$$ of those cases as substring, so it will be solvable with the same answer. Can't think of better way...

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

        if n=1 ---->impossible if n=2, ()--->impossible, )(---->(()) n >= 3: if in the string str, we found "((" or "))", then just construct ()()().., such string "((" is not substring of ()()()... otherwise, the string must be alternative, ()(.....or )()...., in this case, we construct ((((...))))

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

        You just have to cover all the cases. There are three partially-overlapping cases:

        1. S = () exactly.
        2. S contains )(.
        3. S contains (( or )) or both.

        We can easily prove that this covers all cases: if |S| = 2 then (), )(, (( and )) are exactly the four possible strings. If |S| ≥ 3 either S contains )( (case 2) or it is a sequence of ( followed by ) and since |S| ≥ 3 there must be at least two of one character in a row (case 3).

        In case 1 there is no solution, because any balanced bracket string must contain (). For case 2 (((...))) is a solution because it doesn't contain )(. For case 3 ()()()..() is a solution because it contains neither (( nor )).

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

    i think you ignore the case when n=1 and string="("

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

    In my solution I just make 2 strings "((...))", "()()..." and checked if input string is a substring of first, then the second is the solution. Also the "NO" answer comes only with "()".

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

Is it just me took a WHILE to clearly understand C...

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

B felt like as one of the most unfun kind of math problems

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

    It felt really forced, like they had to place a problem B somewhere and came up with a contrived problem

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

      During the contest I've got the general idea pretty quickly, something like:

      • Use as many of the non-fancy $$$k$$$ coins as possible
      • Fill the rest with as many of the fancy $$$k$$$ coins as possible, then use $$$1$$$-coins
      • In some cases we want to use 1 less fancy $$$k$$$ coin, then fill the sum with $$$1$$$-coins

      But translating that into actual expressions felt terrible, at least for me

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

Why all the problems is about to find all possible combinations of the answer and build the solution upon that, it felt like disguised combinatorics round.

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

How to solve D? I have only one observation: Lets call number of 01 — number of 10 "Balance" When I swap i, j such that a[i] = 1 and a[j] = 0 I add i — j to balance and j — i otherwise Please explain full solution to me

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

for D we can see that whenever a swap happens, the sum of 01 and 10 doesn't change. Also looking at 10000, we can see that we can just move the 01 and 10 2 unit closer to each other by swapping an additional 1 more character to the right.

tldr is the diff between 01 and 10 count must be even. Swaps 1 and 0 always move the diff between them by an even number. So just swapping the best 1 and 0 pairs until they are equal

Is this a greedy problem? Wondering why s <= 100.

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

this was WA2forces for me but the problems were good

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

Problem E is almost the same as this one. Check out 211055789 and 219307318.

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

Nice contest! Gain a lot.

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

Can we do E like this:

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

In Problem D what can be the maximum size of 0 or 1 individually as the string can always be made balanced

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

How to solve B?

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

why dp solution dosent work for c , 219347506 thanks.

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

Couldn't solve C because I swapped a1 and ak while taking the input OR

cin >> m >> k >> ak >> a1;

Help me cry

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

so many case handling :((

˙◠˙˙◠˙˙◠˙

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

Problem B is one of the worst problem description

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

The worst tasks I've ever seen

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

does anyone has proof for greedy approach on D ? also I would appreaciate it if you could explain the dp approach , I couldnt find it in contest time :/

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

How to solve D?

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

    I can't prove my solution. But actually greedy approach works. Let's denote $$$cnt1$$$ equal to number $$$01$$$ occurs in $$$s$$$ as subsequence and $$$cnt2$$$ equal to number $$$10$$$ occurs in $$$s$$$. Now let's find such $$$i$$$ and $$$j$$$, that after swapping $$$s_i$$$ and $$$s_j$$$ we will make $$$|cnt1 - cnt2|$$$ smallest. Swap $$$s_i$$$ and $$$s_j$$$ and continue doing this until you get $$$|cnt1 - cnt2| = 0$$$.

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

Does, Problem B is based on Binary Search?

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

Actually a simple way of solving problem A is to check whether there exists a pair of adjacent brackets that are both left or right (like “((“ or “))”). If true, the answer should appear like “()()…()” If false, the answer should appear like “(((…()…)))” The only exception is string “()”, u just need to especially judge if the given string is exactly that thing. I personally consider C harder than A, because it took quite a long time for me to figure out how to solve LIS in O(nlogn) time…

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

    i don't think lis is needed though:

    My submission that passes tests 219294134.

    When i find a new m2, that element is winning because it can't reach any former m2 (all of those are bigger) and there's an m1 that the m2 can reach (meaning that a move exists and it leads to a losing state). It's easy to see that all the other moves are losing : if an element doesn't enter any of the ifs, it's trivially a losing one as that can reach another losing element (basically it can reach any m2, as it's bigger).

    This proof feels harder than the code, i 100% didn't think it this way when i wrote it but it feels right.

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

From the rules of some earlier rounds:

" 12-hour phase of open hacks after the end of the round (hacks do not give additional points)

after the end of the open hacking phase, all solutions will be tested on the updated set of tests, and the ratings recalculated "

Will this thing (rejudge on successful hacks) be used here?

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

n^4 passing for D:

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

Hope codeforces catch all of them https://youtube.com/@codingSchool2.O

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

Hi, i am a beginner , tried the first question didn't got it then went to the second one , thought that i might be able to do it but then time passed and i wasn't able to do it. can someone give solution or tell where i can find proper solutions suitable for beginners.

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

Nice massive hacks on D

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

I HAVE OBSERVED THIS TREND IN RECENT CONTEST THAT LANG OF QUESTIONS ARE TOUGH TO UNDERSTAND. ITS MY HUMBLE REQUEST TO MAKE SINPLER STATEMENTS IF POSSSIBLE

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

    I do agree that it's frustrating to read long statements. Moreover, I also agree that long statements does not fit for contests where time is short. Especially, for platform like CF. However, your all caps comment made it hard to read. Hence, my conclusion is your comment is not much different from unnecessary long statements! LOL :v

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

Can someone write a blog about this because more than 800 watched the videos https://youtube.com/@codingSchool2.O

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

    Deleted

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

      I don't think it's feasible for Mike or any other admin to track all the cheaters. Especially, folks who share codes outside the platform anonymously. At the end of the day, it's just an online contest. If you focus on learning and growing your problem solving skills it does not matter how many cheaters out there. Certainly, they will have some impact on the rating. But rating is just a number. If you can solve 2 problems in div 2 on average now, your concern should be how can you solve 3/4 regularly in the future. Cheaters will most likely stay at the same level because their main focus is not learning and growing skills IMO. That means at some point you will surpass them if you continue working on improving. And from that day onwards, they will not have much impact on your rating.

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

How to solve E? I already knew how to get the shortest path from a pair of character to another. But my solution seems to run in m*26^4 so it didnt pass :(

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

    Let MX denote 26*26. We can create (n-1+MX) nodes weighted directed graph. n-1 represents cursor position while 26*26 extra nodes represents all possible two length strings. For the ith position of cursor we have to add edges of weight 1 between each pair consecutive positions ,an outgoing edge from current position to string cursor is representing as weight 0 and incoming as weight 1. Now we can calculate distances to all other nodes from those MX nodes in O((n+MX)*MX) using 0-1 bfs. Now we can reach from p to q without going to any of those extra nodes in abs(p-q) steps or if we visit any extra node the answer from such a node can be computed as d[p]+d[q]-1.So each query is computed in O(MX). So final complexity stands O(MX*(n+q)) for my approach.

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

Around 1/3 of Problem D AC's hacked

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

Can someone explain the C problem solution, or just name the type of problem? Got the A and B, C was out of time for me.

UPD: Damn it was easy....

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

problem statement of B was difficult for me to understand

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

A simple solution for C

Key solution: A number is unlucky iff 0 or 2 jumps to left are possible from it.

https://codeforces.me/contest/1860/submission/219359755

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

Editorial for problems A&B:

https://youtu.be/p-nKn3Hg9JE

Thought would be useful!

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

do we get anything for hacks? Like less penalty?

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

Why so much down votes ?.At least they puts efforts to make contest for us.We don't pay anything.

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

Great contest, although I didn't address D. This idea of D transferring the contributions generated by the two 01s to the characters themselves is great!

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

How i can solve B with binary search?

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

Hello everybody, I made a submission for C a few minutes ago (after the contest). Even though it says Accepted, i have the feeling that it will FST. It's just over 15 lines (apart from the template).

Try hacking it.

Code

Submission: 219367730

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

    It is correct, because it's a convoluted version of the solution vinren explained above. Compare with his solution: 219313622.

    To see that it's the same, consider that whenever you do set.upper_bound(-x) == 0 you are effectively asking: is the minimum element in the set less than x? But to answer that question you do not need to maintain the complete set of values; it's sufficient to track just the minimum.

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

Codeforces ---> Queueforces

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

Shall I get bonus points for a successful hacking on the 12 hour hacking phase?

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

Did somebody use this approach to solve problem B? I just come up with it now. The code is commented so you can understand whats going on

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

Thank you guys for the contest . it was a very good contest, i hope next contest will be the same

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

I find myself stuck in A B C general math problems. Due to this I am not able to give time to harder problems during the contest.

This thing happened with me in last contest's B as well as this contest's B. I find it difficult to understand some general math based solutions.

Can anybody give me suggestions for how to quickly come up with mathematical solutions. This really slows me during the contest. Even while practicing problems I have noticed this weakness.

I am quite ok with number theory problems. Difficulty arises when some general math and greedy are there.

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

I didn't participate in the contest. But why so many downvotes eh? I think problems were good. I love A,C,D, and E. Although I find B is a bit too "mathy" but I don't think this contest deserves that much downvote tho

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

    Maybe due to the weak tests for D. I like the problems themselves too.

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

      I guess pretests for D were weak so that "hacking phase" served its intended use.

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

        There are no so-called "pretests" in CF mode. I can understand weak pretests in CF mode (actually most users don't). However if the tests in exICPC mode are weak, the wrong solutions will pass as long as there are no users are hacking.(for example, when some significant events take place and high-leveled users are not online)

        Anyway, optimistically, this gives a lesson to user who do not prove and check their solutions. This will influence a lot of people in future CF mode contest!

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

It hurts so much to get hacked for the first time, maybe many wrote to the greedy in D and will be able to understand me.

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

It hurts so much to get hacked for the first time, maybe many wrote to the greedy in D and will be able to understand me.

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

Why not system test (i’m new here pls no downvote)

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

Problem C is so interesting that I spent almost one hour on it.

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

Почему никто не делает видеоразборы на русском языке? Было бы прекрасно, если нашлись бы такие люди.

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

Can anyone tell where can we find the editorial to this contest?

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

Hi, awoo, do you play genshin or starrail, which leads you to provide these weak pretests?

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

Problem E is actually similar to this.

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

Good round, but problem B...

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

Hackforces round.

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

I am currently a newbie and the details above says that the contest is rated for those with rating below 2100 so why is the contest listed as unrated on my profile? Someone mind explaining?

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

the problems were good. thanks for the contest adedalic BledDest awoo ! ignore the downvotes

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

why this round is showing unrated even if i am in Div 2 ??

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

Can anyone please explain this elegant solution (219271388) of D by jiangly?

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

    wow, that's a fantastic solution.

    I guess the idea is: let c00 be the count of 00 pair, so does c01, c10, c11. Given c01 = c10, we have

    1. c00 + c01 + c10 + c11 = n(n-1)/2 (all pairs)
    2. c01 + c11 = c10 + c11, which is also the number of pairs end with 1 and begin with 1.

    let c0 be the number of 0s, c1 be the number of 1s. we know the sum of the total number of pairs begin with 1 and end with 1 is c01 + c10 + c11 + c11, so for each it is ( c01 + c10 + c11 + c11) / 2,which is param "need"

    then uses a dp[i][j][k] to find the min ops to achieve need, where i means consider first i items, j means the total 1 been used, the k means the (c01+c11) till now. And the value is how many position we put 1 but it is 0 original.

    The answer is dp[n][c1][need], because each swap we can put a 1 in its final position

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

I want to report @erfge56gyt4w5h356 for obfuscating his solution of E.

https://codeforces.me/contest/1860/submission/219309571

I though this wasn't allowed by the contest rules.

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

I didn't solve a single task — I was unsuccessfully struggling with task B the whole round, — but still got +125 points ¯\_(ツ)_/¯. Is there any article on how rating on Codeforces is calculated?

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

    Maybe this will help link

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

    I'll try to explain it without going into the math behind it. In the first 6 rounds combined you get a bonus rating of 1400, split as 500-350-250-150-100-50 and your assumed rating for your first round starts at 1400.

    Your rating change according to your performance will be calculated as bonus + (whatever you get because of your assumed rank vs gotten rank)

    So basically you had a 250 bonus already as it was your third round and whatever you got was a score that stacked onto that

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

where is the editorial?

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

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

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

I had misread problem C, B was like too many if else statements.

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

I misread problem C, it was interesting though. Also, B was like too many if else statements!

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

It was the best codeforces round (in my opinion), thanks to BledDest, Neon, adedalic and awoo!

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

About my solution to Problem C 219315276 was judged to be duplicate, I used the source code that had been published in 2017, its content is linked at: https://blog.csdn.net/George__Yu/article/details/75896330 Your text to link here... I don't think that constitutes cheating

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

Где сложности???