Всем привет!
В воскресенье в Москве прошла пятнадцатая Московская командная олимпиада — командное соревнование для школьников, проходящее в Москве как отборочное соревнование на ВКОШП. Над туром работала Московская методическая комиссия, известная вам также по Открытой олимпиаде школьников по программированию, Московской олимпиаде для 6-9 классов и олимпиаде Мегаполисов (раунды 327, 342, 345, 376, 401, 433).
Раунд состоится в 14:05 16 числа и продлится 2 часа. В каждом дивизионе будет предложено по 6 задач.
Задачи соревнования подготовлены Andreikkaa, Sender, Flyrise, mingaleg, kraskevich, wilwell под руководством вашего покорного слуги, а также GlebsHP, meshanya, Endagorion и Андреевой Е. В.
Если вы участвовали в МКОШП, участвовать в раунде строго запрещено. Не обсуждайте, пожалуйста, задачи и их решения с участниками раунда до его окончания, это является поводом для дисквалификации.
Всем удачи!
UPD: Всем спасибо за участие, поздравляем победителей раунда!
В Div1 ими стали:
В Div2 ими стали:
Разбор появится сегодня несколько позднее.
UPD2: Разбор!
Is it rated?
It's rated!
Every time when I wrote a comment "Is it rated?".. there is always someone to reply ""Every time I see comment "Is it rated?". Yes, it is."" :D
Every time when I wrote a comment "Every time I see comment ""Is it Rated?"" " there is always a reply "Every time when I wrote a comment "Is it rated?".. there is always someone to reply ""Every time I see comment "Is it rated?". Yes, it is."" :D"
It is rated!
Anyway, i'll downvote you for asking the question.
yAs iT iS rAtEd
Old way to get downvotes man be creative like me! I'm the master of downvotes in CF you can see my blogs or my comments to learn more about downvotes
:D what differ to me if I get downvote or not.. Actually I never care about to be down voted..
Arabs don't have short.
Dude we have short but we don't wear them
Крутой контест)
Recent contests are nice for me because I'm in UTC+8. Another good_time_contest is coming, good luck to all of you.
Recent contests were nice for me because I'm in UTC+8. Another great rated round is coming, good luck to all of you.
212 = 441
Mind = blown
I had just done a contest yesterday xD
Насколько это надежно участвовать в раунде, в котором могут принимать участие люди, которые в свою очередь ознакомлены с заданиями? Стоит ли пропустить?
Можешь смело участвовать. Живым после этого раунда точно останешься.
То что я останусь живым это конечно радует, но все же как то это странно... ведь кроме того что люди могут сами писать этот контест еще и могут другим рассказать что да как решается)
Забей. Главное —
РЕЙТЕНГ
!Я смог его как раз поднять на этом соревновании)) да и задания интересные...
В смысле надежно? Задачи от этого хуже не становятся :)
Вообще это довольно частая ситуация с раундами по мотивам школьных мероприятий.
Задачи я уверен будут интересные и сложные)) Но вот рейтинг сильно зависит от количество человек набравших большое количество баллов... Я не знаю насколько много человек из Москвы участвовало в МКОШП и сколько у них друзей которым они поведают решение)) Может ли их большое количество сильно повлиять на распределение рейтинга?
зависит чисто от того, насколько ты нарешаешь, несмотря на других
мда, поколение пошло... изменение рейтинга зависит от места в таблице относительно других участников
Я бы сказал, что почти для любого участника, отличного от Гены, средний разброс места на контесте сильно превышает количество людей, которые могут его обогнать нечестным образом. Но это моё личное непрофессиональное мнение.
и к чему ваш комментарий, если он является логическим следствием из моего... мда, ну и поколение прошло...
вот совсем не является следствием
Yap, two Consecutive contests in two Consecutive days. It's really amazing. :)
That too with two Div1 contests in two days. I was sad that I was unable to give yesterday's round, but seems fine now.
Yes, it is rated.
Great!
Can't compete this contest :(
orz
The timing could have been better, as Indian college students mostly have classes till 5 PM .
So?
Good luck to all the participants
A great time for chinese students again!
I think so.
why?
because we in the UTC+8,and its just evening.
GL & HF
Scoring distribution?
Their history also shows that no scoring has been ever announced.
will my rating change if I have one WA and Tle in the contest but no correct submission?
yes
R.I.P English
Орнул с условия Div2F
Посылайте лучи плюсов в сторону mingaleg, самый орный автор задач московских олимпиад
Когда заблокировал задачу, понял, что решил ее неправильно и ждешь, пока она упадет
I don't know Russian but i want to know the puns!
You are still waiting for somebody to explain you the puns? You could have already started learning Russian!
Why there are only Div2 and Div3 contest?
Are you considering the contest TooNewbie?
What is pretest 9 in E?
WHAT IS DIV1D PRETEST 10 AHHH
Make sure you are not overcounting the subarrays. Try this test case: n = 3, a = [2, 4, 4].
answer is 2?
Yes.
I see that you had WA10 in contest but you managed to fix it. Is there any other case that you had to fix before getting AC?
Maybe overflow? I had only this issue with my code fixing which got me AC. I hope this won't fail the systest. :P
How to solve F?
First, convert princes to nodes, and princesses to edges. You can show if the set of edges is a valid solution if and only if it is a psuedoforest (https://en.wikipedia.org/wiki/Pseudoforest ). So, it suffices to find the max weight pseudoforest.
It turns out this is a matroid, so adding edges greedily works. All we need is an efficient way to check that each connected component has at most one cycle.
Apparently my first submission tried to do this but I used = instead of |= in dsu. I think replacing it will make it correct. Have to wait after systest to submit it though.
UPD : It got accepted.
Lewin is absolutely correct, though this approach may be described from a different point of view without matroid theory.
Consider a princess that is the best match for both of her princes. In an optimal solution this princess should be covered with an edge (otherwise we may force one of her princes to marry her and it will be at least the same profitable).
It turns out that we may remove such princess from a graph (adding her value to the answer) and contract two her princes into a single super-prince having the union of edges of the original princes. It's easy to prove that it is an equivalent transformation.
It leads to exactly the same solution that uses DSU to keep contracted princes.
How to DIV2C?
Hint : What is the number with maximum sum of digits?
Note that numbers up to 10^9 have at most 9 digits. So the maximum we can add to a number is 9x9 = 81 (putting 9 in every digit).
Therefore we can just bruteforce 100 numbers (just to be safe) from n-100 to n checking if each one of them + the sum of the digits equals n.
that's exactly what i did..... first time solved div2 C..... hurraayy! But B not solved xD
My incredibly overcomplicated approach is this:
We can represent any number x as a0 + 10a1 + 102a2 + ... + 10nan. If we add a number's digits to itself, we will obtain a number k = 2a0 + 11a1 + ... + (10n + 1)an.
Let's fix a0, a1, a2, a3, a4 = 0, and try all possible combinations of (a5, a6, a7, a8), generating all 104 integers k = (105 + 1)a5 + (106 + 1)a6 + (107 + 1)a7 + (108 + 1)a8 and storing them in a map. Then, we can fix a5, a6, a7, a8 = 0, then try all combinations of (a0, a1, a2, a3, a4) in the same way. For every integer k generated in this step, we can just check if n - k exists in the map we created before.
Complexity: O(105log(105)).
Hi I was trying something similar. But why do you fix First five numbers?
My submission
We should minimize 10x + 10y, subject to x + y = 9. (10x = number of integers generated in the first step, 10y = number of integers generated in the second step.)
I tried exactly the same, it's like a diophantine equation. But, i didn't know how to solve it whitout bruteforce all the combinations, O(109) in the worst case.
Why check n-k?
Let consider sum(x), sum(x) is the sum of the digits of the number x
x + sum(x) = n
x = n - sum(x)
it's mean that you can just do bruteforce by the sum of the digits.
Let maintain current sum as cursum, if sum(n - cursum) = cursum, we add n - cursum to our answer
Complexity O(log(n) * maxsum)
Am i the only one who solved the first task using dp???
I did it too, much easier to code :P
After 2 wrong submisssions, I give up greedy and solve A with DP.
me too.
You're not alone :D
Best contest ever. :)) I have never passed D. :))
clicked the submit button 7secs before end of the contest, but it was not submitted. Now this thing has happened to me twice on cf.Just a suggestion, but maybe cf should consider accepting submissions for 10 extra seconds after the contest? As server is usually slow at the end of contest, this should not benefit people submitting just after contest.
How to solve DIV2 E?
What was the hack for Div 1 C?
I was hacked on the case when I tried to set to some letter that it should be capitalized don't paying attention that this letter can be already marked as a letter that cannot be capitalized.
I failed in test case 62 31410790
I reduced 5 to satisfy 5->4 but did not reduce 3 so 3->5 became unsorted. My solution got accepted by running the recursion twice 31414586.
I think the accepted solution is still incorrect. If there are three items I need to be reduced instead of two then I need to run the recursion 3 times. I guess there are no test case of such scenarios.
How can Div1.F be solved in 9 minutes?
I think more difficult problems are better.
Maybe the author just wants to see if there is anyone doesn't see the f problem from beginning to end
Div1 A is exactly same problem to Atcoder Regular Contest 034 B (http://arc034.contest.atcoder.jp/tasks/arc034_2 [old Atcoder contest, Japanese]), so I managed to solve in 2 mins.
I think even copy-pasting the submission of this problem can lead to AC of today's Div1 A.
Unrated contest :P ?
But I think the effect is very small, so it will be rated.
Is there anyone who understood Div1B?
Why after adding
sort(a+1,a+n+1)
to my submission it fails on test#1 on TLETLE#7 31410864
TLE#1 31411210
UPD : Already found
So to me, the key was understanding problem statement. I almost failed at Div2 D(Div1 B) but somehow managed to guess what authors meant. However, I completely failed at understanding Div2 E(Div1 C). Redefined 'Lexicographical order' was way too difficult and confusing.
div1b, div1c, div1d = [div1c, div1d, div1b]
div1b was pretty easy . maybe like div2b
Div2B is usually a task that could be submitted by average expert/candidate master in something like 10 minutes. Maybe I'm dumb but I didn't manage to find solution in ~30min while contest and ~30mins after.
well i solved it in 11 minutes so it was like a div2B to me
Am I the only one who used segtree + binary search on div2 D?
I too used a SegTree. Not Binary seaching though. Was really blown when I saw the actual solution!
why binary search? I maintained the rightmost position of zero in one segment tree and count of ones in an interval in another segment tree. So, the answer is just 1 plus count of number of ones present before the rightmost position of zero.
I used BIT+binary search
I thought it would fail as number of iterations were > 1e8,but it still passed in 218 ms :D :D
xD mine passed in 608 ms
I thought i was the only person used O(nlog^2n) algorithm in the world...XD Luckily, it didnt FST....
Am I the only one how solved it with Disjoint Set Union :)
Can you explain how you did it with dsu??
I just keep tracking on the rightmost consecutive X's and my solution passed in 156ms :)
How to solve div2 E ?
Build a graph on letters which should be updated together. If the strings are different, there is only one pair of letters, which decides that the previous string is lex smaller than the next one.
123
124
Add edge 4->3 to the graph, which means, that if you capitalize 4, you have to capitalize 3 too.
125
124
You must capitalize 5 and you can't capitalize 4.
In the end run dfs from every letter you must capitalize. Check that the letter which can't be capitalized, was not capitalized.
I also checked special case
1245
124
Which gives no immediatelly.
P___ Your comment helps me a lot to solve the problem.. thanks for sharing your idea :)
You're welcome!
it's my pleasure to be so :)
2-sat.
I do not remember 2 sat solution exactly but I know that strongly connected components were involved. For this problem, we have DAG (edges are from higher letters to lower).
nice contest but really d was translated soooo bad
It seems like there are a lot of people failed the first system testcase of Div1C (including me T_T).
Unlocking new bandage: FST Master.
That's me!
Magolor orzzzz
It's friendly to Chinese
WoW!So many guys solve all the problems,You are so great The solution size of F seems so short,amazing!
Problem almost the same as F was used in this contest in Petrozavodsk as problem A in 2012.
Surpisingly, team
Moscow SU T@pirenock: Evstropov, Ivlev, Pyaderkin
was 12th in that contest, having two incorrect attempts at problem A :)This is the link to its statement.
access denied, fix pls
Can't tell for Gleb and Michael, nontheless, I should have participated in that contest as a training around 2013. Of course I didn't remember this problem until this moment, otherwise we wouldn't have taken it in Codeforces round :)
Almost 6 years is a long time period. Not sure if it is possible to remember all problems since you have started participanting in a programming contest. This problem in particular was suggested for a contest as an easier version of wilwell course work.
PS so to me seems like a notorious coincidence.
Where is div2 rating update?
In div2 B, why we don't need to calculate the difference between elements of multiset, just calculate the number%m and push it in vector array or map to count it's size?
because (a — b) % m = (a % m) — (b % m) (and + m if it is negative). We save numbers (a, b) which have same remainder (x). a % m = x and b % m = x => (a — b) % m = x — x = 0 (that's we need). And it works for all pairs {a, b} if they have same remainder.
Can someone please elaborate how to solve Div.1 F? Thanks!
Editorial will appear soon, but you can refer to this comment tree right now.
Thanks a lot!
How to solve Div1D or Div2F ??
start placing the numbers in decreasing order on the array now for each number that you put find out how many new intervals you can choose which contains this number . now its obvious that these intervals cannot include any of the already placed numbers (you can find the bound easily by std::set) now for each j that the current number & pow(2 , j) = 0 find the first place after and before the current place that number y & pow(2 , j) = 1 . now you have two intervals . just some conditions and AC
Thanks a lot ...
youre welcome
I think my solution is basically the same thing as what you described. Is Nlog^2N supposed to pass, or is there a more optimal solution?
Mine was pure
It can be optimized to n log max easily with a pre calculation that for each bit and place we store the next and previous 1
I solved it in almost the same manner as from the recent 1418G - Three Occurrences. My code here : 95019408
Am I the only one who doesn't like large problem statements.
I still didn't get the problem Div2D? :(
Still no tutorial yet...
For DIV2 D,it's more hard to read than write.
life sucks