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

Автор vovuh, история, 6 лет назад, По-русски

Обратите внимание на необычное время старта раунда.

UPD: Мы не можем хорошо оценить сложность некоторых задач, поэтому рекомендуем вам прочитать все задачи и подумать над каждой из них.

<almost-copy-pasted-part>

Привет! В Dec/28/2019 20:05 (Moscow time) начнётся Codeforces Round 611 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6 или 7 задач (или 8), которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Я постарался сделать приличные тесты — так же как и вы буду расстроен, если у многих попадают решения после окончания контеста.

Вам будет предложено 6 или 7 (или 8) задач и 2 часа на их решение.

Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
  • не иметь в рейтинге точку 1900 или выше.

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацию моей работы. Спасибо моим очень хорошим друзьям Дарье nooinenoojno Степановой, Михаилу awoo Пикляеву, Максиму Neon Мещерякову и Ивану BledDest Андросову за помощь в подготовке и тестирование раунда.

Удачи!

Также хочу сказать, что участники, намеренно отправляющие неверные решения и взламывающие их после окончания соревнования (пример), не будут показаны в таблице лидеров по взломам.

</almost-copy-pasted-part>

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

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

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

![ ](mem2)

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

Three back to back contests today — AGC 041, Codechef December Lunchtime, CF Round 611. GLHF!

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

When I registered for this round my rating was less than 1600. But will this round be rated for me if my rating become 1600+ before starting the round (after updating rating based on Educational round 79)?

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

??????THE BEST HAKER?????

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

Funny magic!

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

Huh, really friendly time for us:

For Chinese users.

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

Before yesterday's contest, I had a rate of 1599 and it was planned to have 0 rate change so that I could participate in today's div3 contest, and yes I am 1599 again :D

My plane now is to get +100 rate change, Can I achieve my goal again? :3 I hope sooooo

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

vovuh always have good contests so I hope it will be one of them. good luck everyone :D

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

![ ](cf)

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

Some experts are listed as official participant. Please fix it.

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

What does the post mean by "Note that the penalty for the wrong submission in this round (and the following Div. 3 rounds) is 10 minutes." Does this mean 10 minutes is taken off your clock for a wrong submission?

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

0h5 — 2h5 AM I'm here :(( but i will try participate.

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

UPD: We cannot determine difficulty of some problems thus we recommend you to read all problems and think about each of them.

Hmm, something's fishy.

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

Today's leaderboard will be colorful :)

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

The announcement for E was very late Costed me 2 wrong submissions Pls look into it

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

Nice F, thanks)

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

numberline forces

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

I couldn't understand problem F completely. Can someone clarify it more ?

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

Difficulty : A < B < C << D,E << F

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

what is the 4th/7th/11th test case in problem E? or what can it be?

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

Great Contest. Managed to solve 4 problems.

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

How to solve D within the time limit?

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

    Greedy problem using a priority queue (min heap) and a flag checker.

    you can keep minimum distances in the queue

    For example, n = 2, m = 3, x1= 1, x2 = 5 Then initially, you need to push (0, 1) and (0, 5) // (dist, position) and set(1) = visited and set(5) = visited

    If -pq,top.first != 0, then add this position to your answer array. and check whether you can insert position+1 and position-1 with your checker. If position+1 is possible, then push(-(dist+1), position+1)

    until you gather m position

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

E was dp or greedy ?

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

Can we use bfs to solve problem D? i always get memory limit exceeded on test 12 :(

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

Thanks for the contest!

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

I had an hour after solving C. I looked D and thought set+pq naive. But I thought it's not the model solution, and gave up. 10 minutes left, I started to code naive, and I've done it after contest. Submit it, AC.

wtf

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

$$$F$$$ was cool. Here's a fun fact: You can prove that number of trees in $$$n$$$ vertices is $$$n^{n-2}$$$ if you have a working algorithm for $$$F$$$!

Your algorithm is deterministic, so it generates exactly one output for each input. Also, as each output corresponds to a unique ordering of edge importance, each output will correspond to exactly one input. But number of different inputs with $$$n$$$ vertices $$$= n^{n-1}$$$ and number of different outputs $$$= nT(n)$$$ where $$$T(n)$$$ is number of undirected simple graphs in $$$n$$$ vertices which are trees. (We are multiplying by $$$n$$$ because same graph with different roots are considered distinct in the output.) Thus, as inputs and outputs have a bijection, $$$n^{n-1} = nT(n)$$$. Thus, $$$T(n) = n^{n-2}$$$!

This is kinda similar to other proofs of Caylee's formula like Prufer Codes and proof of Caylee's formula by double counting.

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

Can someone help me figure out what is going wrong in my submission for Problem E 67835042. Thanks in advance.

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

HOW TO SOLVE E? PLS EXPLAIN IN BRIEF!

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

Why should C problem this submission 67826496 should be ac? Something wrong with the judge program?

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

What are the hacks for C ?

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

I really liked this Div $$$3$$$ contest because

  • The difficulty balance was decent. It was not too difficult, yet not too easy.
  • The problems were not very implementation based (like $$$598$$$ for example). After getting the basic idea, it was easy to implement it.
  • There were no subtasks

A great Div $$$3$$$ Contest to end the year !

mango_lassi I generally refer your solutions. How to solve $$$F$$$ ?

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

In C, can we also change the value which is not 0 ?

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

problem D I used unordered_map but I got TLE. I instead of map is AC??? why? I think umap is faster than map. please explain for me, thanks!

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

For all who is surprised by why this was the accepted solution: I am surprised not less than you. Thank you badcw for noticing this.

I will try to explain why this happened: when I wrote the checker I forgot to check the stupidest thing — check that all $$$nf_i = f_i$$$ for such $$$i$$$ that $$$f_i \ne 0$$$. I don't understand how could I forgot to do this, but this happened. As you can understand, nobody noticed the mistake and during the round nobody informed me about such weird thing. The comment above is the first source where I found this issue.

I'm very sorry about my stupidity and I didn't want to ruin your fun from participating in this round. I apologize to everyone who was and will be affected by this mistake. I know that MikeMirzayanov who is the (usual) author of the whole problemset is upset by this fact and I understand that many of you are also upset by this fact. Now I cannot do anything with it and can only apologize.

We will make a decision to make or not make this round unrated a little bit later and will inform you as soon as possible.

P.S. I can't even imagine how many participants can be affected by this issue and I'm so scared to find out it :(

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

My approach for problem C is to sort the array containing not_occupied position. Iterate from 1 to n and if at any i ar[i] is 0 and i!=maximum_not_occupied_position ar[i] = max_not_occupied_position else ar[i] = min_not_occupied_position.

Still my soln gets hacked what is the counter case please tell

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

in problem 3. if we print n 1 2 3 4 . . . n-1; for all n. will it be correct solution ??

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

What is the correct way to solve C ?

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

    You can maintain two sets:

    The one which are bad positions set (i.e Index = unfilled element in array) and the other good positions set(i.e are missing from array but no problem as their value != unfilled_position in array)

    Now, you just need to handle the bad positions set first.

    I did it in the following way, there can be various other ways.

    for example, if my array was 3, 4, 6 of bad positions. I would circularly assign positions, example a[3] = 4, a[4] = 6, a[6] = 3;

    and for the remaining 0's positions, you can assign as you wish from good_position set.

    Here is my submission — https://mirror.codeforces.com/contest/1283/submission/67828215

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

    I listed all the ones who did not give gift and all the ones who did not receive gift. sorted these 2 lists.


    compare a[i] and b[i] if equal: swap a[i] and a[i+1] 5 2 1 0 0 0 a=[3,4,5] b=[3,4,5] i=0 a becomes [4,3,5] i=1 a stays the same i=2 a becomes [5,3,4]
  • »
    »
    6 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Let s be the set of people who didn't give their gifts yet. Let t be the set of people who didn't receive their gifts yet.

    For every person in s, assign to him any person (different from him) in t. Note that this is possible for all people in s except the last one (If we assign greedily). However, it's guaranteed that at most 1 person will be assigned to himself. Assume this person p exists. To fix this issue, choose any person (!= p) in s (This is guaranteed since it's given that the size of s is at least 2) and swap his answer with the answer of p. Done :)

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

Hello everyone... I need help >_<. Can anybody check what's wrong with my solution of problem C if you don't mind. (Although it's already hacked xD, but I don't know how to see the test case) https://mirror.codeforces.com/contest/1283/submission/67820446

I'm trying to figure out the correct way to solve this. Thank you!

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

Very nice contest with interesting problems. Thank you vovuh.

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

Can anyone here tell why using unordered_set is giving me TLE on D , where as using only set is passing the tests?

unordered set solution,
set solution

the unordered set soln was working fine until test case 5, which is of same order as test case 6, but giving TLE in test case 6;

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

The procedure in F defines a bijection between set of all trees with labeled $$$n$$$ vertices with one vertex picked and set of sequences of length $$$n - 1$$$ with entries from $$$[1, n]$$$, which proves, that there are $$$n^{n - 2}$$$ labeled trees with $$$n$$$ vertices. Really nice :).

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

Press F for vovuh :(

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

For C task, were we aloud to change spots that weren't 0 or not? Cause the task says we need to fill in spots that have 0s in them, but during hacking phase I saw a solution that just printed sequence 2 3 4 5 ... n 1 (which was accepted).

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

Can someone help me find the reason why my submission for problem D get TLE on 12, and it's memory is too large, it works pretty fast before test 12.

67830125

Thanks in advance :)

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

What is the probability tag for c?

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

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

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

Problem D is a beautiful application of all-sources BFS.

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

How to solve F?

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

Code Can Someone help I am getting WA on testcase-19 of Problem E

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

How to find the first answer in problem E?

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

Can someone provide an explanation to the greedy solution for task E. I am able to calculate the max value ; however I am slightly missing something while calculating the min value

Why Am I saying SLIGHTLY MISSING can be found looking at my answer and jury's answer to the failing test case

I think there is maybe some more ways to merge than I have taken into account. A deeper insight on the greedy approach to the problem would be appreciated. Thanks in advance.

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

I see too many hacks for C...wonder why??

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

Code

Could anyone tell me what problem is in my code? (min part)

I merged 3 consecutive values to center one. (I marked flags)

And then I merged 2 consecutive values to right one. (I marked flags to avoid a wrong move)

Finally, I merged possible (exist none exist) cases to the center(none).

Thank you for helping me!.

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

Here is my solution for problem C. It is been hacked but still I'm not getting any testcase where it is going wrong. Can anyone please look into my code and say where will it go wrong!

67816712

Thanking you in advance for your help

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

Is the round rated?

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

Really weak pretests :(

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

So what's the result after about 12 hours of discussions. Is it rated?

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

My first 1700+ !!

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

I hacked 7 people in open hacking phase but still didn't get any positive response on my rating or my total score, isn't it weird ??[user:vovuh][user:MikeMirzayanov]

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

Nice contest, especially F problem))))