Привет, Codeforces!
15 апреля в 17:35 MSK состоится Educational Codeforces Round 19.
Образовательный раунд проводится в рамках инициативы университета Harbour.Space. Это уже второй раунд, проведенный при поддержке Harbour.Space. Подробности о сотрудничестве Harbour.Space и Codeforces можно прочитать в посте.
Учебное направление Data Science университета Harbour.Space несомненно интересно большой части аудитории Codeforces. Вот несколько слов об этом направлении от Сергея Николенко, преподавателя Harbour.Space и старшего научного сотрудника математического института имени В. А. Стеклова РАН (СПб).
Раунд будет нерейтинговый. Соревнование будет проводиться по немного расширенным правилам ACM ICPC. После окончания раунда будет период времени длительностью в один день, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.
Вам будет предложено 6 задач на 2 часа. Мы постарались сбалансировать проблемсет таким образом, чтобы было интересно как новичкам, так и опытным участникам.
Раунд вместе со мной готовили Иван BledDest Андросов и Михаил MikeMirzayanov Мирзаянов.
Надеюсь, вам понравится, и желаю удачи!
UPD: Разбор
Поздравляем победителей:
Rank | Competitor | Problems Solved | Penalty |
---|---|---|---|
1 | Reyna | 6 | 214 |
2 | tqyaaaaaaaang | 6 | 230 |
3 | nuip | 6 | 303 |
4 | W4yneb0t | 6 | 341 |
5 | lexuanan | 6 | 457 |
Поздравляем лучших взломщиков:
Rank | Competitor | Hack Count |
---|---|---|
1 | step_by_step | 40:-7 |
2 | halyavin | 44:-17 |
3 | STommydx | 20:-5 |
4 | yp155136 | 18:-2 |
5 | FlierKing | 24:-15 |
Было сделано 234 успешных и 308 неудачных взломов.
И, наконец, поздравляем людей, отправивших первое полное решение по задаче:
Problem | Competitor | Penalty |
---|---|---|
A | Lewin | 0:01 |
B | 300iq | 0:04 |
C | fanache99 | 0:09 |
D | Reyna | 0:21 |
E | Vladik | 0:08 |
F | skywalkert | 0:40 |
It overlaps with GoogleCodeJam round 1A !
UPD: It doesn't overlap .. thanks for yinanzhu and KieranHorgan
so, go for only one, which you like more!
Actually It doesn't.
You must messed up the time zone of either contest. Hope you find out before it's too late.
Google code Jam round 1A
Educational Codeforces Round 19
Exactly. When the educational round starts (16:35) 11 hours after the Code Jam round ends (05:30).
OOPS, I missed it, I'm very sorry .. thanks KieranHorgan and yinanzhu
is it rated?
Really?
Why not all the contests have clear problem statements like this one. Thank you for this interesting contest.
How to solve F?
I don't know the time complex of the std. But the time limit makes me think that the std have the time complex of O(n2).
My solution's time complex is , and it costs 858ms.
First it's easy to come up with the DP of O(n3). Then let's look at the programme carefully, and we can find out that it's very similar to Knapsack problem. And this classic problem have a classic way(divide each original item into items) to optimize it to
We can use the same way to opimize the original problem. Then we solve the origine problem in
Can you provide a link or even better explain it yourself the details of the optimization ?
My solution is quite strang and not elegant. I recommand you to read this guide:http://mirror.codeforces.com/blog/entry/51567?#comment-354676. I think this guide is more easy to understand and to write the code.
very interesting problem set. I hope to see more problem set like this! :D
Can anyone tell me why im getting TLE on E. My idea is precompute for every k below 1000 in O(N) each and just simulate all k bigger than 1000 (worst case scenario is 100 operations if im correct) 26393091
The precomputation is probably too slow. Change 10^3 to sqrt(10^5) and it will probably pass.
Edit: you didn't calculate the dp properly http://mirror.codeforces.com/contest/797/submission/26394436
I still get TLE even with this :/ 26394497
Check the edit up there /. You can't use 1000 not because of time but because of overflow on short int operations.
Thank you man!
Did someone pass TL42 with mincost maxflow on F?
Never thought I could make more points than some reds or oranges. Strange contest =)
How to solve C ????
You can solve it greedily.
I am so dumb :( ....I really do not know anything :(
How did you manage to solve A and B if you consider yourself as dumb? :)
Can someone explain to me why in the second test for E the 8th number is 2?
p = 1, a[1] = 3, k = 1, n = 10;
Initially p = 1. After first operation p = 1 + 3 + 1 = 5. After second operation p = 5 + 3 + 1 = 9 < 10. What am I missing?
In the first operation p = 1 p = p + a[p] + k p = 1 + 3 + 1 p = 5 In the second operation p = 5 p = 5 + 7 + 1 p = 13 p > 10
Ah, I see. Thanks! I completely missed the fact that when p changes the array element chages as well.
Please discuss the approach for problem F.
You can solve it using dynamic programming. Let DP[j][i] denote the minimum cost to assign the first i mice to the first j holes. For each state, iterate over the leftmost mouse you will assign the jth hole to. This takes O(m*n*n) time.
But notice that for a fixed j, the optimal left-point is non-decreasing for non-decreasing i, i.e. optima[j][i] <= optima[j][i+1]. So you can speed up the DP using divide-and-conquer optimisation.
Code
How do you deal with hole capacities and the fact that contiguous mice are not necessary assigned to the same hole?
The group of mice assigned to some hole is always contiguous, i.e. there will never exist a situation that a,b,c are three consecutive mice (in increasing order of coordinate) but a and c are assigned to hole-1 but b is assigned to hole-2.
And what do you mean by how I deal with hole capacities? If I have to assign some suffix of the first x mice to hole j, then I can assign atmost the last capacity[j] mice to hole j.
Just a moment after I posted, I realized sorting was enough to assign contiguous mice to a hole.
As for the hole capacities, yep, I meant that (and I missed it's as simple as that!)
Thank you :)
Can someone please help me in finding mistake in my Solution for problem C.
Your code fails for this testcase : abcbabbcc
Your code outputs aabbccbcb whereas the correct answer is aabbbcbcc
Can someone tell me where I am wrong in D?
I made a fucntion
checkValid
which takesnode
,l
,r
as arguments. And marks true ifvalue[node]
lies betweenl
andr
both inclusive. Then, I callcheckValid
withleft[node]
, and with the intersection of(-inf,value[node]-1)
and(l,r)
. The same process is repeated symmetrically for right node.I am getting WA at Test Case 20. And my answer differs by 1 from expected answer.
Submission Link: 26396243
There were two mistakes.
One was a syntax error at line 92. Second mistake was I was remembering the nodes which are visited instead of values.
AC solution: 26398128
No successful submissions on E in Python 2 or Python 3. I tried to rewrite one Java solution to Python, it TLE-ed on test 7. Isn't the time limit of problem E too tight for Python?
It's my first time to try hacking here on CF. Not sure how it works. It seems to be just stuck loading forever. Is this supposed to happen?
Reload
I tried reloading many times, and also clearing my browser cache/cookies before trying again. This happens after I submit the input for hacking by the way.
Can anybody tell why my code is failing in one of the tests ?? https://pastebin.com/GC45xUAa
26389948
^This implementation is similar to yours. You can refer to this one.
Its quite confusing . He has considered even more cases . Can you read my code once and tell me , which case I might be missing ??
That's how you try to cheat even in an unrated round!!
ScreenShot
That's how you try to cheat even in an unrated round!!
ScreenShot
I noticed that if I submit a solution after a previous solution got hacked, then my new solution runs only the original system tests, and not the hack(s) that caught my previous solution(s). That's too bad, because that way I can be "Accepted" again without fixing my problem (in fact, I have no idea whether I fixed my problem unless the hacker is kind enough to keep trying the hack on my new solution).
UPDATE: Appears to be fixed now.
Can someone please help me in finding mistake in my Solution for problem C.
http://mirror.codeforces.com/contest/797/submission/26402069 why this submission always wrong at 25th test case???who can help me ??
I'm unable to submit a solution for the contest. It shows that System Testing is going on, while it was over hours ago.
On clicking the submit button, it shows the message "Practice is allowed only for finished and unfrozen contests".
Is it normal that problems B and C now have duplicate tests? For example, there is the test #48 "1 // 1" that repeats further as #50, 51, and 54. Problem C also has such tests, e. g. "a" by #40, 41, 42, 45, 47, and 51.
Хотелось бы увидеть разбор.
Извиняюсь, не добавил ссылку на него в анонс, сейчас будет
UPD: Не будет, почему-то кф при попытке публикации изменения блога вылетает в "страница недоступна"
UPD2: Преодолел, с другого браузера нормально получилось
Разбор
Спасибо.