Всем привет)
Сегодня состоится очередной раунд Codeforces #161 для участников Div. 2. Как и всегда, остальные могут поучаствовать в нем вне конкурса.
Задачи для вас подготовили авторы: Павел Холкин (HolkinPV), Николай Кузнецов (NALP) и Геральд Агапов (Gerald). Традиционно хочется поблагодарить Михаила Мирзаянова (MikeMirzayanov) за систему Codeforces и возможность проведения соревнований. Также благодарим Марию Белову (Delinur), которая перевела условия задач. Также выражаем благодарность Артему Рахову (RAD) и Виталию Аксенову (Aksenov239) за помощь в проведении соревнования.
UPD: В раунде будет использована динамическая система оценки задач. Задачи отсортированы, по мнению авторов, по предполагаемому порядку увеличения сложности.
Надеемся, что соревнование окажется удачным для всех участников, успешных взломов и высокого рейтинга)
UPD2: соревнование завершилось) надеемся оно вам понравилось
Поздравляем победителей:
1) poao900
2) persianpars
3) Sert
4) valentin.harsan10
5) MeinKraft
UPD3: разбор задач опубликован, его можно найти здесь
Hey, I believe I just saw a post where blogger and PavelKunyavskiy are the writers of the contest!
That was a stupid joke.
Strangely enough, it appeared on the front page.
me too
I don't know anything about it.
Последняя тренировка перед 1 туром регионального этапа. Всем удачи
I think is time to have some more information about the score and difficulty distributions :)
UPD:Thank you.
Wish epic failures to everyone! ^.^
Удачи всем
Помоему у многих С — шка на 4 тесте упала.
Can somebody explain how solve problem D in O(N)?
It is guaranteed that each node of the graph is connected by the edges with at least k other nodes of the graph.
Therefore it's possible to form cycles from any point (I think) So I do a DFS on node 1
Let's go from vertex 1 and build a chain. At each iteration, if we are in vertex v, if exists some vertex u, that is in our chain at distance at least k, then we go to it and end the cycle. Else some vertex u exists such that it hasn't been visited yet, so we go to it. At some moment we'll end the cycle, because it's only finite number of vertices at all.
Build up the cycle as a path, until the last vertex of the path is the same as first one. Start with an arbitrary vertex. For the first K+1 vertices of the cycle, use a greedy approach — K times choose one vertex which is not in the path and connected to the last vertex of the path. There will always be one (because at most K-1 vertices apart from itself are in the path, so there must be at least 1 neighbour vertex left). Now, augment this path in the same way, until you can't do it. Then, take the last K vertices of the path; the last of them will have at least one neighbour other than those, but all his neighbours are in the path, so there must be a neighbour X of the last vertex of the path; add it to the end of the path. This way, there's a simple path in the graph, which starts and ends at X, and contains at least K vertices. BTW the time complexity is O(N+M), and it's optimal.
Thanks everyone for explain :)
Расскажите, пожалуйста, решение задачи C.
Переберём в лоб первых 4 позиции. Остальные восстанавливаются однозначно. Меня взломали, но я думаю, что если писать более аккуратно, это заходит.
Достаточно первых трех. При чем, первую перебирать не надо, можно ее захардкодить, например — 1. Получается, достаточно перебрать только вторую и третью позиции
Для n=5 ответ 1 2 3 4 5, для n=6 ответ находим перебором, иначе находим ближайшее к текущему число — для них количество равных чисел, с которыми они соединены, равно двум, и продолжаем поиск из того, что нашли
32 test
нужно проверять что у вершины не более 4 рёбер
если нарушено то заведомо -1
при n==6 перебор + отсечение антипод(та единственная вершина с которой не связана текущая) в пути через 2 вершины иначе любой цикл длины 6 через разные вершины замкнут , что не правильно
Первые три числа в 3-ем претесте E можно узнать?
Does the dynamic scoring system take into account unofficial participants from div 1?
No.
How to solve problem C
Case N=5 is clear. Bruteforce N=6. For N > 6, there are vertices a,b,d,e, all connected to vertex 1, and connected in the order in which they appear on the cycle: a-b-1-d-e; among them, only b and d are also connected. So you can find b and d — the only points which have 2 common neighbors with 1. You now have a part of the cycle: b-1-d. If you have a part A-B-C, then you can find the next vertex D on the cycle (A-B-C-D-...), because it's the only common neighbor of B and C other than A. Complexity: O(N).
Раунд отличный, задачи интересные!
well done everyone and what a brilliant problem C. :) can anyone explain any easy to code in C++ :) solution for problem C? I think this question is truly common between all the contestants :) thanks everyone.
Новая страница статуса с автообновлением рулит.
Мы её еще допилим. Будет еще лучше!
Мне так не хватает прыгающего шарика. Может, вернете?
Согласен, верните шарик пожалуйста, как то скучно без него
Поддерживаю
Только там с временами был какой-то треш. Совсем в перемешку показавались.
Все починим, мы тоже заметили.
Currently most of the fastest solutions to the problem E are written in Java, you don't see it often :D
Thanks for a good contest!
There are some straight-forward backtracking codes for D which are getting ACed. Really curious how this is possible :/
One dfs is enough to find a solution for this problem. That's why backtracking needs only one branch to find the answer so it works in O(N + M).
At least one AC solution fails at this test:
My guess is than in all tests vertex number 1 is on the needed cycle.
I'm guessing a lot of cases can be made where the backtracking fails. I don't know how they made their testcases :/
we could visiting and put time stamp on it, suppose you are visiting node i, it must connect with k nodes, if one of them not visited, continue visit this node, if all the k nodes are visited, now we have the solution, the start position is the one in these k nodes which have the smallest time stamp, the length from it to node i must larger than k.
I've also found a code that fails in the case gen has given above. This case definitely should be added and rejudged to maintain fairness. (no matter how many minus i get :) )
I guess it would be good if you send this testcase with the failing code(which got AC) to Gerald or contest writers.
Anyway I suppose test number 18 is something like this. since I saw some of the solutions which used maximal path that were trying to create the cycle with first node of the path(instead of the last). These solutions got WA in test 18. In the testcase answer shown to us there is no "1" in the answer so I suppose in this test first node wasn't actually in the cycle.
First 10 Minutes in the contest i was happy that i solved A and B problems, but i shocked after that :)
persianpars did impossible. congratulation persianpars.
thanks i still don't believe that i finished second
ehhh... This is my first time that I think I can solve problem C in contest. Although I fail, but it gives me a good time. thanks !!!!
Nice contest!
Problem set was really good. I really enjoyed the contest. Best round for me so far.
Yeaaaaahhhh !! This is the first time I solved the E problem — I guess it wasn`t that hard :)) -
Also it seems that in certain problems (like this one) the title is a hint (good to know :)
My time complexity was
O(n*m*k)
, actually it wasO((n-2*k)*(m-2*k)*k)
. Can it be done faster than this ?I see something strange in your contest stats, it seem that the solution for B is still in queue o.O
I know. I got AC and then the status changed. I have no idea what the problem might be ... :-??
but the limits aren't good for this problem... if k = n / 4 the complexity is n/2*n/2*n/4 = O(n^3) which should not work in 3 sec i dont think there are faster solutions cause all the sources are like this
В С разобрал 41 тест перед отправкой на листочке, но почему-то в программе его не пофиксил :(
I have solved 1 problem in this round (in the running contest) but my rating got down from 906 to 872 .I have also solved a problem in running contest of Round #156 (Div. 2) but the authority didn't increase my rating . why????
Your rating depends on how well other people did in the contest as well. Probably almost everyone did solve at least 1 problem. So that's why your rating did not increase.
I think if you want to increase your rating, you should learn a lot of things before taking the next contest.
Maybe because you need to solve more than just the first problem to increase the rating :D
несмотря на этот комментарий контест рейтинговый?
1 — Рейтинг уже пересчитали.
2 — Думаю не все мутили бэктрэкинг. У меня на этот тест выдало 3 4 3 2.
Такой же ответ 3 2 3 4
Editorial is published here
for problem B somebody tell me is this a valid input? if yes what is the correct output for it.
It's incorrect input because "It is guaranteed that all given squares are distinct."
Ok thanks.
I post my solution in Chinese,anyone can view it. here is my blog
How could such a boring problem such as Problem C be rated 2000? Yuck.