Всем привет!
Скучали? Уверен, что нет! Но так или иначе, вашему вниманию представляется ещё один раунд, к подготовке которого я приложил руку. Добро пожаловать в мир безыдейных задач, заунывно длинных и скучных условий и плоских шуток в анонсах.
В этот раз раунд для вас готовили Ильдар Гайнуллин (300iq) и я (ну мне стыдно делать ссылку с этим цветом, сами знаете, кто). Мы хотим поблагодарить Владислава Исенбаева (winger), Константина Семёнова (zemen), Алексея Шмелева (ashmelev), Ивана Смирнова (ifsmirnov) и Александра Фетисова (AlexFetisov) за прорешивание раунда и помощь в подготовке. Также отдельная благодарность отходит Николаю Калинину (KAN) за его помощь в роли координатора и, конечно, MikeMirzayanov за polygon и codeforces.
Мы очень надеемся, что вам понравятся задачи, удачи на контесте!
UPD. Также спасибо akvasha за то, что любезно дополнил наш проблемсет своей задачей.
UPD 2. The contest is over, congratulations to winners!
Div. 1:
Div. 2:
Here are editorials.
Man! I need such sense of humour!
Anyways, GL and HF.
Guess who is more pr0?me me me. Do you even code bro?
how to get a better Contribution?
stop commenting or you will get more down vote :)
"Добро пожаловать в мир безыдейных задач, заунывно длинных и скучных условий"
Бррр, что-то страшно стало аж(
Пережил контест от адаманта и не упал в синие!!!
Когда попал в мат. ожидание места
Контесты adamant — обосновано статистически.
Пожалуй пропущу...
Great Grand Duke Olexandr Kul’kov
I'm sorry but you have some small mistakes.
It's more correct to write Oleksandr (or Alex if you are lazy to write long words).
"Great grand" is a bit tautology. But if you mean that Oleksandr is a great guy then maybe it's ok.
Sources: link, standings of some competitions and wikipedia.
I hope my comment will help you :)
Logged in just to upvote you
Неееееет !!!
When the announcement is so exciting, I bet the contest will be awesome!
Пожалуй не буду участвовать
Ты думаешь, тебе было куда дальше падать?)
Welcome to the world of extremely unoriginal problems, awkwardly long and boring statements and trifling jokes in anouncements.
sees some problems from his past contests
Okay I'm bracing myself :D
Isn't this clashing with Topcoder SRM 726 ?
Мой первый КФ будет от адаманта....
Сочувствую(
Мой восемьдесят третий КФ будет от адаманта....
Сочувствую(
Мой второй SRM (первый в div1) был от Пети, именно так я и побил рекорд по самой большой волатильности на топкодере)
how many number of problems will be there?
FUCK TC SRM. It is clashing with cf round so no way i'm missing it!!!
hope for no long queues. c:
awkwardly long problems??? why??? ):
negative comment seriously? do you really like them?:D
Nooooo... CF and SRM are clashing :/??? Seriously?
Hope either Codeforces or Topcoder will change starting time as soon as possible.
Unfortunately, when we announced this round, there was no SRM on this date on their schedule. When they announced it, it was too late for us to move this round.
Hi, I think there was Data Science Newsletter (of Topcoder) titled "It's Data Science Newsletter Time! SRM this Saturday & the 19th!" in December 9th (10 days ago) and it has a schedule — "SRM 726: December 19 at 11:00 UTC -5". And I remember that the date that announced this round was less than 10 days ago. So I think "When they announced it, it was too late for us to move this round." is not true, isn't it?
I've put Round 453 on the schedule on the 7th. You know, it is the end of the year, we have a lot of rounds and I also have a lot of other things to finish, so wasn't able to move it, sorry about that.
But that's a matter of 90 minutes, was it so hard to put the contest in the 'usual' time (19:30 MSK)?
After SRM we can start no earlier than 21:05 MSK, it is too late. Before it we can start no later than 16:35 MSK, it is too early.
1) So if I understand correctly following events happened in this order: a) you scheduled round on today, b) topcoder announced their SRM date, c) you announced cf date. If that's correct you can't blame them for putting SRM at clashing time.
2) 21:05 MSK is too late? Many people from Russia participate in SRM at 5:00AM MSK. Or did you mean some other issues?
1) By scheduling I mean posting it on the public schedule at /contests which propagates to calendars and so on. So I use this word in the same meaning as announcing.
2) Yes, it is too late. Rounds are made not only for red coders who write contests even at 5:00 AM, but for everybody.
1) In that case I'm sorry for suggesting wrong statements.
2) IMHO 21 is perfect time to have a contest. 18 or something can always be troublesome because some people still have courses on university or work. 21 is safely after all such activities and 23 is not too late to end contest (for me, but it depends on a particular guy). And even if it is too late for some people then I guess that having two contests, one at 19MSK and second at 21 MSK is significantly better than one at 18:35 MSK and 19 MSK. Did you try contacting TC to reschedule their SRM since CF was announced first? I guess this is worse for TC than for CF, so if they value what they do they should at least consider this.
Will the rounds be rated?
Maybe! It will be specified Later. Anyway, That is enough to have contest to learn and enjoy. :)
Maybe semi-rated!
Or x-rated!
xxx-rated round, not safe for work.
phew...and i was worried no one's gonna ask that...XDDDDD
After retired from ACM-ICPC, I still have something to do with Codeforces, something like becoming a MASTER, just for fun. # Hello the world without training!
Intriguing announcement :D !
Every Third Contest I do on Codeforces becomes unrated due to Server Issues / Test Cases Issues etc. FINGERS CROSSED
Not today, I hope :D
I request the problem setters to restore the difficulty level of problems, the last 2 contests were a bit easier.
Even then you didn't participated.
After I read this blog , I am afraid to participate in this ...
Good Luck everyone! Wish everyone will read "long" problem statements as quick and understandable as possible !
This blog was "key" for being on top 10 contribution leaders ...
adamant gonna be pulling our strings tonight (ahem).
Есть много правды в описании контеста...
Вау! Потратил 70 минут, и не смог таки решить Aшку, ggwp
This was the contribution to Global Warming :) [ LOTS OF TREES ].
Why can't I see other's solution to hack? Only thing I see after clicking the solution is Update adobe flash. I use chrome browser.
Have you tried updating Adobe Flash Player?
I too cant hack after locking the problem. I have all the tools installed
Try Firefox
maybe flash is disabled in chrome, click the circle near codeforces url and allow flash.
How to solve Div1 C?
for each i , find smallest j such that [i,j] induced subgraph has a cycle , to do that , build a max spanning tree(weight = min(i , j) for an edge i <-> j) , now its just some path queries.
thought this. couldnt implement in time. sad.
nice !
How To Solve Div2 Problem A? Can anyone Explain?
Maybe I can.
So, you should initialise "int RightCan[submission:33422641] = 0" — the farthest point you can reach. (And you can also reach ALL the points before it — from 0 to RightCan).
If a[i] <= RightCan — then we can reach the start point of teleport[i]. So, we can change RightCan to b[i], if (b[i] > RightCan). (This if very impotant... becouse otherwise we can decrease RightCan!).
It's know that a[i] >= a[i — 1], so we don't miss anything.
And now, if (RightCan < m) you should print "NO\n", otherwise — you can reach your goal and print "YES\n".
Here is my solution: 33422641
If it is possible. Can you help me, please? In pretest 5 we have:
In what way can we teleport from 11 to 13? Thank you in advance. In my solution http://codeforces.net/contest/902/submission/33436932 i had wrong answer.
Well, look here:
3 7
0 6
1 2
4 7
Your solution gives the answer "NO". But your can reach point 7: 0 -> 4 -> 7.
port 1: [0 _ 1 _ 2 _ 3 _ 4 _ 5 _ 6]
___port 2: [1 _ 2] ___ [4 _ 5 _ 6 _ 7] <-port 3.
This happens because your looks only on the 2 last teleports. _____________________________________________________________
And yes, isn't mivael right?
The basic idea behind the solution is you have to find is there any discontinuity between 0 to M.
To check this Take an array A of size M or greater having initial value 0.
now take the input [x;y] and do this.
A[x]+=1;
A[y]-=1;
after doing this take prefix sum of array a using A[i]+=A[i-1] form i=1 to M.
now if any element in array A [ 1 to M ] is equal to 0 except last value then answer will be 'NO' Otherwise 'YES'
Can you explain how prefix sum work in this case?
Take an example.
N=3 M=5
0 2 ; a[0]=a[0]+1,a[2]=a[2]-1
2 3 ; a[2]=a[2]+1,a[3]=a[3]-1
3 5 ; a[3]=a[3]+1,a[5]=a[5]-1
after doing this your array will look like
[1 0 0 0 -1]
now after taking prefix sum your array will become.
[1 1 1 1 0]
no element is 0 except last one so your answer will be "YES" in this case.
What's the pretest 3 on C ?
How so solve Div2D?
Also, though I was able to solve Div2C , someone please share the logic of it. I saw some people did C quite quickly. That was like fucking awesome.
Was it so easy or some general problem that I don't know?
What I did was for one tree, I kept adding all the children to a single node. And for the other tree, i just remove one child and put under some other parent. Hope this is the right logic though
Hmm seems nice and same as mine. :)
Although I was able to come with one more logic though a bit late but I believe this will work.
No two consecutive terms should be not equal to 1.
I mean to say that no two non unity terms should have distance less than or equal to 1.
This will suffice as a condition. For designing a tree, your and my logic should work I suppose.
There can be consecutive 1's. The condition is there should be atleast 2 consecutive 2's(or numbers >1)
Yes..That is the thing what I wanted to write. :)
This is what I implemented. Let's see if it is right, lol.
How to solve Div2 D/Div1 B?
B. I went for a DFS solution. set the root color and then dfs iteratively coloring the nodes
He's mentioning the Div1B, not the Div2B.
He is asking Div1B.
lets work on
f0 = 1
f1 = x
fi = fi - 1 * x + fi - 2
answer is fn, fn - 1
Yeah I did exactly the same.
Or use Google: https://en.wikipedia.org/wiki/Fibonacci_polynomials
Usually I self-proclaim myself as someone who knows many things about math, but here you proved the opposite.
Thanks for the enlightenment you brought ;) I got stuck for an entire hour with D and not even knowing about this ;)
How do you use Google in such problems? I guess that searching "polynomials euclid algorithm small coefficients" would yield no useful result and even on that page you provided I see no useful info (without that mod 2 trick that I still don't understand these Fibonacci polynomials are useless).
You can do it by arbitrary mod. Mod 2 is to keep coefficients below 2. The thing is that if you calculate gcd using some mod and has k steps you will have at least k steps calculating it in rationals.
Using this formula,
f2 = x*x + 1 = x^2 + 1 and f3 = x*(x^2+1) + x = x^3 + 2x
Since, the coefficients should be from -1 to 1. So how did you handle this part?
mod2
Thankyou! :)
Instead of mod 2, can we multiply it with (-x) ?
Yes but some higher degree polynomials may contain coefficients outside the range. So you need to multiply with x or -x depending on the current situation.
But the coefficients won't be -1 0 or 1 right?
(I don't know.. I am probably wrong but please tell me where I am wrong)
Working in means the coefficients are taken mod 2
f3 = x^3 + 2x, however all the coefficents must be in [-1;1]. How did you solve this issue?
UPD: solved
What? I have no idea why this works :f. This seems like key idea here, but I see no meaning behind it.
It's well known that GCD takes the longest time on fibonacci numbers. This is just an extension of the idea from numbers to polynomials
If we abandon condition about coefficients being from set {-1, 0, 1} then this problem is trivial, I was well aware that without it we can do fi = xfi - 1 + fi - 2... What is tricky here is that reducing mod 2.
if we work on instead of , then this obviously works since fi mod fi - 1 = fi - 2 since x * fi - 1 + fi - 2 mod fi - 1 is obviously fi - 2
in , this fact still remains true , since degree of fi = degree of fi - 1 + 1 and powers of x are independent over .
I still have no clue about your solution. It is of course true that over , but I see no connection of that fact to Euclid algorithm in and have no idea what this independence has to do with anything.
well fi mod fi - 1 = fi - 2 even in , are you sure you didn't misread the question and thought that coefficients should be {-1,0,1} even for immediate steps?
Let's make it clear what is obvious ans what is not:
Obvious fact 1: If we define fi = xfi - 1 + fi - 2 over then we have over
Obvious fact 2: If we define fi = xfi - 1 + fi - 2 over then we have over
Obviously false statement: If we define fi = xfi - 1 + fi - 2 over then we have over
Since that last fact is not true, I see no connection of your solution to Euclid algorithm.
And regarding "are you sure you didn't misread the question and thought that coefficients should be {-1,0,1} even for immediate steps?" — during contest I was solving that wrong question you mentioned (however I am pretty sure you meant "intermediate" not "immediate" :)), but I realized it was not necessary some time ago and still have no clue about it.
EDIT: Sorry, I made a typo in first version of that post in "obviously false statement"
ah , i finally get your point , i completely forgot this during contest and just implemented it straight away thinking "its just a div1B , it can't be that hard".
Let me think about it for a while
The proof isn't that hard. Start from the two polynomials fn, fn - 1. Now do Euclidean algorithm over on these.
You can show the following claims by induction. First, all fractions during the process will have odd denominator. Also, the numerators of a polynomial pi(x) you get during the Euclidean algo over will have even numerator if and only if the corresponding coefficients in fi(x) is 0. In particular, all leading coefficients will be fractions with odd numerator and denominator.
okay here is a much simpler reasoning of why this takes n steps
Suppose on the contrary , it takes < n steps , then for some i , fi mod fi - 1 has degree < i - 2.
fi = fi - 1 * (ax + b) + r(x)
degree of r(x) is less than i - 2
let fi(x) = ... + pxi - 2 + ...
and fi - 1(x) = ... + cxi - 2 + ... dxi - 3 + ...
then we have p = bc + ad in , since each of them are rationals and 2 is obviously a prime , each of these terms exist in as well hence this holds in as well and we have degree of r(x) is less than i - 2 in as well which is a contradiction.
Just try random polynomials: one of degree n and another of degree n - 1 till it works.
Alternatively, you can set P0(x) = 1, P1(x) = x and for i ≥ 2, set
for some choice of sign. Exactly one choice of sign works once you fix $P_2(x).$ A computer can verify that this works, but I have no proof.
отличные семплы в задаче С! я за две минуты до конца только понял, что я решаю задачу на рёбрах, а не на вершинах... благо решения вроде не отличаются
how to solve c and D?
...... ( f(x) , x+1) -> (x+1 , x ) -> (x,1) -> (1,0)
каждый раз надо находить такой f(x) что f(x) mod (x+1) = x (в нашем случаи ) но я так и не смог написать )
I think Div2C Greedy problem
can you please help me with my code : https://ideone.com/talzy9
test
5
1 2 1 2 1 2
You program is wrong Answer is "perfect"
can you please explain why the answer is perfect in this case?
EDIT : my bad now i understood thanks a lot for the help ! :)
btw if i am correct the cases of perfect are those which don't have two consecutive ai > 1 ? if i am incorrect please correct me!
I change you code. I think its correct
"awkwardly long and boring statements"
Lol so true
i dont understand problem C, output sum(a[i]) E i = 0->h
That refers to the number of integers you are to print. The summation is nothing but the number of nodes in the tree
How to solve div1B?
What was the purpose of putting "tree" in title of D? To give a hint for contestants :f?
In Russian is graph instead of tree :/
For those who ask about seeing others' submissions/hacks/adobe flash player:
set these settings:
Allow website to use Flash
i am able to see others submission history but unable to see solution even after locking!
Lol, I hacked a few people on Div1A because they did something like
cout << ans[i]
whereans
was of size ~10^5.NOOOOOOOOOOOOOO!
1e5 ?
Can you elaborate?
Nice contest. Couldn't understand C for an hour and after i understand it i solved it in 20 mins. But in general nice.
What is Div2 (A) pretest 6 ?!
What Div2 (A) pretest 6 ?!
May be something like.. 3 10 0 9 1 5 7 10
Ooooh, I did break while getting input. My output in pretest 6 was: -- NO NO --
This is the way a codeforces contest should be prepared.Kudos to problem setters.
Overall, the problems are good. I think ive seen Div2B & A with some changes, the C and D are so challenging. Even though, i almost made it, apparently i didnt. (._.)/, I'm actually really tired but i rushed to join this contest because i wanted to get my expert rating (AHAHAHAH), I ended up doing really sucks, and sloppy (Because of my skill in graph). Lesson I learned in this contest, sometimes you need a rest between contests. :). Merry Christmas !
Update : I think B is easier than A. A is kinda "tricky"
I've just ruined another div1 contest and now i'm thinking whether it's even possible to come up with an idea for div1B if you've never seen anything similar before -_-
Well everyone had their own bad day :(. I can relate to what you feel.
Anybody anything to E? I can only generate 10^8 pairs as candidates for (sum of ai, sum of ai2) :/
There will be editorial very soon, please be patient :)
Через сколько после контеста начинается системное тестирование? Или, может, обойдемся без него? Мне мои претестные результаты нравятся))
Hey, is he a cheater or acts like tourist in the last cs round ? :‑Þ
Could you explain exactly what makes you think he could possibly be a cheater?
maybe submissions time?
How is solving three problems in 1 hour and 52 minutes suspicious?
so you c am asking if a cheater || !
Are you a cheater, by the same token?
with 2 years in gray ? -___-
I finished coding C/div1 5 minutes after the contest with O(n log n) solution :(
can you please share your approach for this!
For each vertex i find the minimum vertex X such that the graph consisting of vertices [Xi i] is bipartite, this can be done using two pointers.
Now iterate over vertices from 1 to n, for vertex i add 1 to the segment [Xi i] then answer all queries that end in this vertex by finding the sum of elements of the segment that describe the query.
UPD: I got WA, seems like the tow pointers approach is wrong
Good contest, problem D div2 could have been better. but in total, it was way better than what you described.
Can't believe I messed up Div2 A :/ Bad day, I guess
Same :/
Can someone hack this , or explain why fit time limit?
Such a Great contest! thanks guys XD
lol BA 150 in task D XD
How did this guy submitted after contest ended?
Most of it was graph theory.\ I LOVE GRAPHS <3 really enjoyed it , keep up the good work.
how to solve DIV-2 D?
Really Simple :p . Check out the editorial.
In div2B why dfs gives the minimum answer.when to apply dfs or bfs i am weak at it plzz help
I guess depends on the logic. I thought BFS way. You need to color root of tree at least once. Just color it in first go and this will make all childs of same color. Put neighbours in queue for bfs and go on like this. Link: http://codeforces.net/contest/902/submission/33421572
You can use both bfs or dfs to solve this problem.
Keypoint is to note that bfs or dfs produce same result in case of tree.
Mostly people use dfs in such questions because it is shorter. :)
https://ibb.co/gHq6Pm
Div 2 problem C 902C - Hashing Trees, Testcase 2 working fine in my computer. But TLE in CF judge 33450049.I'm unable to find any TLE reason.
Undefined behaviour or bug in compiler. The first is more probable. Look at the output of your program.
You mentioned "unoriginal problems", evidently I found almost similar problem of div2 A — A. New Year Transportation :D
@adamant: One doubt was this the source of motivation for this problem? :D
How to solve Div 2E? I need some implementation details.