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

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

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

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

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

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

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

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

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

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

Удачи!

UPD: Также очень хочу поблагодарить Ивана Gassa Казменко за неоценимую помощь в подготовке раунда!

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

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

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

vovuh and div 3 still a better love story than Twilight :P

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

:)

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

All the best everyone :)

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

I wish this round becomes unrated for me soon.

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

 And finally the wait is over!

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

DIV 3 rounds can be risky for higher specialists.

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

Again same question, Why don't we have some extra testers in these rounds(Educational/Div-3)? If I am correct this won't reduce the quality of contest, rather it would increase the contest's quality.

Can we please start having some more testers in Educational/Div-3 rounds? As they are rated contests and any issue noticed during contest would just affect participants.

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

    I just encountered one more past educational round which was unrated because of an issue with problem A statement. Educational Codeforces Round 64 (рейтинговый для Див. 2)

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

    They do have 6 testers in this round. Does it affect the contest quality in anyway, if none of the testers belong to the rating range for which the contest is rated? I am guessing it might affect the order of the problems a little for easier problems, as high rated testers might not notice the difference in difficulty as much as a contestant for whom it is rated. That apart other issues related to questions should mostly be covered

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

      I am just trying to make a point that having a list of testers with different rating group won't adversely affect the contest quality, rather it may improve it.

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

Exicted for the rare div 3 round. Does div 4 round even happens? Hoping to see some nice questions

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

More than half of the comments are downvoted ! :-{

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

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

Is there a way to participate after the 9:35 UTC-5? Sadly, these competitions always happen during my school hours and I really want to participate. :(

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

Does anyone know that whether Technocup Elimination Round will be rated or not

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

Is this Rated for me? guys?

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

Can't wait to see the problems! Good luck everyone! :D

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

Wish you all the best ♥

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

Is it rated?

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

When will div. 4 return ?

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

Good Luck for Everyone :)

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

It's valuable for waiting such long time :)

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

Finally wait is over. Hope I can get rating above 1000 today:)

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

.

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

Hope I can reach green this time

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

What is the points distribution for the problems? Or are there none for Div. 3 contests.

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
int rating=1134;
rating+=150;
»
3 года назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

This comment section is shit.

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

If I submit multiple Accepted solutions, which one will be taken as my final solution (that is, used for others to hack?)

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

Screenshot-2020-11-24-215410.png
I felt like the dumbest person on the planet on reading this line after wasting 40 mins to solve a #P-complete problem.

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

    me too!! I'm too sleepy to read wrong question, trying to solve n vertices, m edges and wasting almost all time.

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

What's the solution of E? Really liked problemsetting (especially F).

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

How to solve E ? F was easier than E for me

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

    There are 2 paths between all pairs except for adjacent pairs within the root on the cycle of the almost-tree. Details and code are explained here.

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

    You have an "almost a tree"-graph. Erase the edges from the cycle, then for each pair of nodes of different components there are two paths, and for each pair of nodes of the same component there is only one path.

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

This contest made me remember the ABC from the past when first four problems are dead easy and last two are not touchable xD

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

    F was easy idea wise if you understand binary search & know a data structure(for range min queries like segment tree or sparse table), it was just about implementing.

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

      Now I am "Afraid" because I did not use a Binary search or segment tree or sparse table.

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

        I agree that other approach will work. But range min query + binary search was definitely the easiest(atleast for me) in terms that it just hit me after a few minutes of reading the statement because that's what was asked to find. When we have some problem asking to find some sort of triplet/pair/quadreplet the first thing i do is fix some of them and then think.

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

        What was your approach?

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

Nice contest! I just want to ask what's the trick behind F. I've tried doing it using two pointers + segment tree, but that fails the test 2. My idea may be too off the right track, but that's what it is. Thanks.

EDIT: Now I see instead of 2 pointers I could have used binary search to solve, better luck next time I guess.

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

Guys what does it mean that there is a penalty of 10 mins for each wrong submission???

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

    Your final score time would be added with the penalties. For eg : lets say your total time is x mins and you have 2 wrong submissions then the final time penalty that would considered while ranking the leaderboard would be x + 20.

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

My Explanations for ABCD

A

Here given a positive integer n > 1 we want to print a permutation of distinct integers from 1 to n such that ith integer is not equal to i Consider the permutation {1,2,3 .. n} if we shift each element from 2 to n one position left and then print 1, that is {2,3,4 ...,n,1} then we are done Since here we are print the next integer for the positions 1 to n-1 and 1 at position n (n != 1),this is one of the required permutations.

Topic : Constructive Algorithm

B

Here we are given an array of n integers. We need to print the index of an integer which is unique and minimum among all possible such integers. So we maintain a map to track the frequency of each element. Iterate the map, check if frequency is one or not , if it is one then minimize the answer. if there is no unique element then print -1.

Topic : Implementation, Brute Force

C

Here we are given an array of positive integers We need to choose an element from this array of integers and use that integer to perform operations The operation is as follows: If we choose x , then remove any subbarray not containing x

We need to report the minimum number of operations So we can brute force all the distinct integers in the array and report the minimum answer

To do this , we maintain a map from integers to vector of integers. This map is from each unique integer in the array to it's indices .

For example let say the array as given in the sample case is [1, 2, 3, 1, 2, 3, 1] then our map will be [{1,[0,3,5]} , {2,[1,4]}, {3,[2,5]}]

To get the minimum number of operations for any given integer x (Let say), we remove all the indices which are not equal to x This can be done by doing the operation when the difference b/w consecutive indices of x is more than 1

For example take [1, 1, 66, 1, 77,88 , 1, 1] with x = 1, Now we have the indices of 1 as [0 ,1 ,3 ,6 ,7 ]

So we check we do the operation when consecutive indices have difference of more than 1. Here it is operation 1 — 1 and 3 (we remove 66) operation 2 — 3 and 5 (we remove 77,88)

Similarly do the operation for all unique integers and report the minimum ans

Topic : Implementation, Brute Force

D

We are given an integer n We need to print a sequence of maximum length such that it's product is n and for each element the next element(if exists) is divisible by the current element First we factorize the given integer n and obtain a map from prime factor to it's power. now we need to print the desired sequence. Since we need to print a sequence of maximum length, we sort the prime factors by their powers, so that we greedily have the element which occurs maximum times first. Let say we have 360,so we make a vector of pairs and sort it by power. that is

{2,3} {3,2} {5,1}

Now we iterate the vector of pairs, until the powers are >= 1

We insert the element until the remaining number is divisible by the current element going to be inserted

For example

we have 2 , remaining is 360/2 = 180, so we insert it. ans is {2}

we have 2, remaining is 180/2 = 90 , so we insert it . ans is {2,2}

we have 2 remaining is 90/2 = 45 , but 45 is not divisible by 2 , so we can't insert 2 , hence we insert 90.

This algorithm produces the maximum sequence since we are greedy picking the prime factor with maximum power.

Topic : Greedy, Implementation, Sorting

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

Will the formula for $$$E$$$ be: $$$n(n-1)-(n-no \,of\, vertices\, in \,the \,cycle)$$$

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

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

What is the case 7 on the problem D?

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

How to solve problem F? Well I applied two pointer approach so it was bound to get TLE. So, I guess it would include some binary search solution.

What was your approach?

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

    I binary sparse in answer. Good Qhuesion. Writer very very intelligent. You also sparse tabul. Else not accept.You understand me?

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

Where can I get the editorial for this contest? I am new to codeforces. Any help would be apprecited.

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

easy peasy Japanesey

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

https://www.youtube.com/watch?v=7WfLE_IIDqA&t=2809s&ab_channel=AoxiangCui this Youtuber live-streamed the live contest today that's the reason there are so many submissions for problem D also.

please correct me if I am wrong as I saw the video a just after the contest and it had 83 views on it

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

    Nope, she is a very experienced streamer. And the video was uploaded at the same moment when the contest ended. And it was never a live stream though

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

where is the wrong in this code ???

"" wrong answer 161st numbers differ — expected: '2', found: '1' "" can I know it?

http://codeforces.com/contest/1454/submission/99493118

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

where is the wrong in this code ?

"" wrong answer 161st numbers differ — expected: '2', found: '1' ""

can I know it?

http://codeforces.com/contest/1454/submission/99493118

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

where is the wrong in this code?

wrong answer 161st numbers differ — expected: '2', found: '1'

can I know it?

http://codeforces.com/contest/1454/submission/99493118

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

    You get wrong answer because you are wrong code. Write beautiphul code. Else not accept. You write in Jabha...hahahahahaha. I not like jabha. You not write jabha. Else I not see your code.

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

Is there anybody who solved problem D with backtracking? :)

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

The problems were awesome!! The magic of Data Structure! ;)

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

submission: 99493024

if(n==100000123) {
    cout<<1<<endl<<2<<endl;
    continue;
}

submission: 99494601

if(n==2001) {
    cout<<10000<<endl;
    continue;
}

Make system tests more and useless. Why do this?

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

Today contest good contest. I very very like today contest. Make tomorrow contest. I give tomorrow contest.

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

E was an awesome problem!

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

Getting F a couple of minutes after the round's end :(

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

Nice set of problems

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

.

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

Now there won't be any div 4 rounds ??

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

Does E,F problems are actually meant to solved by div. 3 users ? Really, I saw some red coders took 30 minutes to solve E.

So how could they expect a div. 3 Candidate to solve problems like E,F in an hour ?

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

    Not all problems are meant to be solvable during a contest, some are their to learn from, that is all. And it is not that E and F are unsolvable by people with rating <1600.

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

    Well, I solved both E and F in the contest and I'm a gray coder, so it is indeed possible.

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

      Yeah, but you are either an alt or have done lots of competitive programming on platforms other than cf.

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

I solved problems B and C without realizing that a_i <= n, and I was very wasteful in general.
I was still very far from the time limit (It would be cool if someone would hack me :P).

I implemented B using a map and a set and even also sort, and I implemented C using a map.

Were those constraints meant to make implementation easier?

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

I did D in a weird way.
Checked every divisor's (except 1) highest power that divides n. Among them took the one with maximum power then generated the answer from that.
Submission: 99476498

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

Thanks vovuh for a round with such elegant problems. Nice learning. Very balanced set of problems which were very carefully crafted and well organized. I am sure this took a lot of efforts from you and team! Can't even emphasize enough on how much of these efforts from you guys help others like me, to enjoy and learn from CF competitions.

Appreciate your efforts!! Thanks again!!

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

Very nice contest with interesting problems. Much thanks to vovuh and MikeMirzayanov !!!

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

handle -> just_try_to_solve has coppied my solutions, as I was using ideone, My all solutions are skipped what should i do, even this person agrees that he copied, then why my solutions are skipped, Please tell something, that person who copied my solution is saying that he agrees that he copies

please put him out of contest, not me

my submission links are as follows — 1. https://codeforces.com/contest/1454/submission/99406543 2. https://codeforces.com/contest/1454/submission/99419833 3. https://codeforces.com/contest/1454/submission/99456510 4. https://codeforces.com/contest/1454/submission/99468339

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

hello,I want to know whether the result are published for this round. because i am not seeing any up and down in my rating also a message is comming "Your rating are rolled back and will be back soon".pls help during the contest i did a misktake which is after submitting the code for first problem which passes all the pretest i submitted it again with the code of problem B and it gives a compilation error then i correctly submit the code of problem A as well as problem B.pls help me

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

    Not an issue , the most recent submissions are judged for evaluation . Ratings are rolled back quite often , there can be many reasons for it , Just chill , Ur recent submissions will be only counted.

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

Last div.3 was rated for <=1600. But how it is rated for This id ? Before participating his rating was 1601.

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

Your method to find the size of the tree hung on cycle vertices was brilliant!