I apologize to the participants of the round. It happened that I accidentally had run improper script and it rebooted the judging machines. It is very insulting, because most problems were proposed by me and I hoped to host an interesting competition for you. A lot of effort was spent on preparation. Apparently, the mistake of just such a human character happened for the first time. I really hope not to repeat it in the future.
Want problems? We have some!
Codeforces Round 434 will start on September 17 (Sunday), 13:05 (UTC). It will be based on Technocup 2018 Elimination Round 1. So, if you are a Russian-speaking high-school student, please take part in the Technocup 2018.
Many thanks to KAN, vovuh, Neon, ifsmirnov, irkstepanov and WHITE2302 for their help in round preparation. Some problem ideas are mine.
I hope you will like problems. There will be 6 problems in div. 2 and 5 problems in div. 1.
Wish you good luck and bugless code.
you forgot to thank MikeMirzayanov
Because he is the author :)
you must be fun at parties :')
Actually, I tried to look like Captain Obvious... Overdid it :D
now i know why didn't thank MikeMirzayanov
Mike himself to the rescue B)
And thanks MikeMirzayanov for the codeforces platform,great polygon and also for this post.
Is it Xxxxx ? (Please no downvotes)
Yes this is rated and every round which has the form Codeforces Round #no. is rated.
are you sure?
No. It Is Not Going To Be Rated Today.
Let me rephrase it. It was going to be rated.
You can see in Calendar
Thx. Sorry for my naive question.
Is this contest only for a Russian speaking student?
It is open for everybody.
Hmm..Thanks
Arsenal is gonna be butchered by Chelsea..
Arsenal better than Chelsea
Yeah, David Luiz almost butchered someone on the pitch.
this round will be rated or not ?
rated ofcourse
Yes.It was rated.
Liar
Sorry for bad knowledge of codeforces, but will there be hacks in the official round?
Yes, You can hack in regular CF Rounds and Educational Rounds.
Thanks
I hope it will have begineer level A like yesterday... ;-)
is it....emmm, interesting ?
Please announce the scoring!
They didn't say, they will. :D
As soon as the contest starts, you can see it both on standings page, and on the right bar.
My solution is 'running on pretest 1' since 15 mins.
testing system is stuck
Such a long queue...!! I guess round should be declared unrated...
Experiencing Queue on hacks for the first time
What would happen if two person attempt to hack a code simultaneously when there is a queue on hacks ??
Is Codeforces mining bitcoin?
Will it be unrated?
twenty minutes to receive a "Memory limit exceeded on pretest 1", RIP points
Similar happened to me.
Exact same happened to me.
such a long queue :( waiting since 20 minutes.
Well, this queue is unresonably long...I must say
This contest
good point
Long queues... So most likely this contest is unrated.
Moment of silence for all our brothers/sisters who realized this news after 2+ hours on this contest, as they were only giving the contest to increase their rating.
In queue...
after the contest end
Wrong answer on pretest 7
My Rating Graph clearly depicts the guy who is the mayor of the friendzone.
I was about to break it through the friendzone and get laid today finally but long queues will most likely result in declaring the contest unrated.
My 2D works OK on my computer but WA on CF, WTF
Please make this round unrated. I still don't know whether my solutions have passed the pretests or not.
Now it showed me wrong answer on pretest 7 for E problem now and time is increased by 10 mins. So much of adrenaline rush !!
I waited for 30 minutes, but my code is still in queue. :(
Yeeey, another unrated round, haven't seen for some months...
I'm alone who's sad that round isn't rated?
me
:(
i am so mad
same
What happened on the juding system? I have participated in some rounds(and watch some) recent two months and found almost half of them get stuck in queue after 1 hour of the contest. What is the bug of this system? Could it be fixxed some time? Very eager to get a fluent contest without waiting for In queue and in queue and in queue..... Or finding the 404 and 403 and 504 and so on.... Hope Codeforces will be a better Online Judge System/
A sad story.This round is unrated...
Well, now I don't have to worry about my submissions failing systests because contest is unrated anyway :)
Unrated :( Rip top 20 :( Huhu
I was gonna have a +120 rating change :(
me too
me +190 :(
how to judge rating change
I use NBHEXT but there's also CF-Predictor
CF-Predictor
NBHEXT
Or you could use The rating formula and write your own scripts I guess.
I sumbit 2B with the same code for twice, and heres the results.
30437680
30439382
It happens again, i think.
30441006
30443306
Well,there must be something wrong with your algorithm.
How to solve Div.2 A?
contest isn't over yet.
Oh sorry, I had an old tab open with the time before it was extended.
Isn't answer just LCM(10k, n)?
Oh of course it is lol. I don't know why I couldn't think of that.
Lol!
my idea for A is: since number of zeros in the end is the minimum of powers of 2 and 5 in a number, I calculate the powers of 5 and 2 that are in the number, and I put more 2's and 5's as needed to make the minimum of powers of 2 and 5 at least k, for example n = 375 and k= 4, 375 contains 3 fives and 0 twos, so I add 4 twos and 1 five (2^4 * 5^1) = 80 and multiply it by 375 = 30000
Finally, my solution for D passed after 30 mins. What a happy story!!!
Really didn't expect this after yesterday's contest, especially considering how the system tests took like 10 minutes. A lot of people have to wait longer to get their submission judged than that entire system testing took. These sort of issues are really unfair on everyone, unfair on those who did well because they won't increase in rating, and unfair to those who got stuck in the 30 minute queue.
Well still no red for me :')
(Ehh why always when I do ok on a round it becomes either unrated or I have a stupid bug and one of my solutions fails)
Or both this time? Your E solution failed :(
aham :')))
your fourth submission pretests are still in queue. Hoping for your statement to come true soon. My E is also waiting.
Perfectly described me.(P.S.:with +1:-3 Hacks by the way)
Same opinion in Div.1...
The first time for me to be in top 50...but unrated...
You know you are a programming competition addict when you get your best rank, and you come to know that the contest is unrated(at the end of contest), and still you are alive.
How to solve F?
Link: http://codeforces.me/blog/entry/11186
I unaccepted 2B 4 times. thanks for the unrated. I don't worry about my rating!
Looks like problem F from this round and http://codeforces.me/problemset/problem/406/C are the same.
Will it take a lot of time to system test? I want to go to bed because it's midnight in my country...
div.1 B
As I understand, the intended solution there is something called "string hashing". Does "string hashing" mean just cramming it all into a hash table as I did (and got AC) or is it supposed to be something more clever?
div1B is bad in my opinion. Just many maps/sets/hashsets will pass, although trie is intended(at least I think, that it is).
UPD: And it's already well-known problem, link is 2 comments above.
Why do you think solutions that require hashing are bad?
For this platform it's bad, because most probably it can be hacked. For instant full feedback contests it's fine.
Well for this problem if we do polynomial hash with base 13 it will fit in a 64-bit variable so I don't see how it can be hacked.
Even for this platform using for example polynomial hash with 4-5 random prime bases and random prime moduli, it may fail, but not by hacking.
Because it's too easy for a Div1 B when you can very easily use map and set from C++
Yeah, seems solutions with map gets pretests with 3500+ms, but I think they will fail at system tests...
My unordered_map solution ran pretests in 1.38 sec
I used unordored_map and it passed in ~2700ms which has a decent chance of passing system tests
I doubt that. There are only at most
values to hash, and I don't think calling map, set, etc. that many of times would exceed the time limit of 4 seconds.
no
it is at most 45 * 7 * 10000 not 36 * 7 * 10000
Yes, I think your right. My notes do say 10C2. I forgot the problem parameters. But it doesn't change my argument that this is reasonable within the time limit.
Yep. It does pass.
30433941
I have a tricky solution. Using map with substring of length 8, for substring of length less than 8, just use array[2.10^7]. :)
My logic for D was -- for every suffix of a given string insert it into the trie then for ans for each string for every starting position calculate the depth of the position where trie[node] has only 1 index Can someone tell whether this logic is correct cuz I got WA.
I did that, so it should work. Was tricky to not run out of memory though.
What is the pretest in div2 B?
2 2 3 1 5 2 answer =1
this should give '-1' right?
my code didnt pass the pretests and i dont know where i'm making a mistake :(
if you know the third flat is on the first floor, on which floor is the second flat?
1st right?
Update: I got my mistake. Shucks and thanks!
thanks dude, I haven't understood this
How to solve div1C/div2E ?
When s̶y̶s̶t̶e̶m̶ pretest testing will be finished?
I'm really disappointed ! Just spend the whole evening and the contest was unrated !
Well...I think despite the slow judgement,spending whole evening enjoying the problems themseves is OK.(Maybe I'm too weak to say that,but we do these problems to improve ourselves and get progress as well...
I Think This Round Should Be Rated And Used This :- New_Rating = Old_Rating + max(rating_change_that_was_going_to_happen, 0);
It is very bad idea, also not fair...
Why Not? Explain Please.
Everyone had problems in this contest, so rating must be changed or not changed for everyone.
One little update: Someone has rating ~1890 and with rating change he will be ~1910, but if there was not long queue in contest, s/he could make 2000+ rating which is better, because with 1910 rating you will fall expert if you write bad in your first contest, but this doesn't happen with 2000+ rating...
Think for next contests, they are wrong again and we will continue to apply your formula and what will happen? Maybe all coder will have rating > 1900. All people will join Div.1 !!! And maybe I will get Red color soon :))))
p/s: I solved 4 problems in this contest, but I don't care about rating.
instead of spamming these illogical comments. Do some practice your rating will increase for sure
Why Are You Calling This "Spam" ?
Because this is just illogical
Illogical != Spam (I Think).
Taking such measures often enough would lead to unnecessary rating creep.
UPDATE: the problem was just casting. Works as expected in GNU G++14, but not in GNU G++11.
So, there is a weird bug with the GNU C++11 compiler... I was getting TLE in pretest 1 with http://codeforces.me/contest/861/submission/30432329 I got it solved by removing the pow call: http://codeforces.me/contest/861/submission/30432756
pow(long long, long long)
pow(10LL, k), where 0 <= k <= 8
Doesn't seem to ever exit the function... but works fine in every other environment I've tested. Waiting for the end of system testing so I can make sure it's really the pow, and only in GNU C++11.
pow() returns a double, not an integer or long long
UPDATE: okay, so I tried it and you are right, pow is returning. The problem is exactly the cast. In GNU G++11
(long long) pow(10, k)
turns out10^k - 1
. In GNU G++14, however, it works as expected.I should have been more careful. Not the first time I have a problem with double -> int casts, and I keep making the same mistakes :).
Since submissions can't be seen until the end of system testing, this is the line: long long k10 = pow(10LL, k); // k is a long long
Even if it returns a double, it's then casted to a long long. The point is, it never returns, so it doesn't even matter what it returns...
How do you know it never returns?
Have you tried with CUSTOM INVOCATION?
Custom invocation was not working (would run forever with any code I submitted), but as soon as it started working again I tested it and now I know it is returning. The problem is the cast.
Todays contest be like
When you finally did ok on a round
How did you get that last delta column?
Codeforces Predictor Chrome plug-in link
bad draw :v
I made a video explaining my approach to problem div 1 a div 2 c https://www.youtube.com/watch?v=p4JGd5g9K9o&feature=youtu.be
After waiting for 10min, my long-queued submission turned out to be WA on pretest 2.
This all happened because there is no thank for Mike in announcement... :(
What is the pretest 3 of div2.b?
I don't know this test, but here is why you got WA3:
When you check if you found another count of rooms for each floor, don't print -1 immediately, also check if n is not in the same floor with previous answer.
top 100 get shirt?
What is the pretest 3 of div2.b?
I'm pretty curious, but what sort of technical errors can lead to a round being unrated? Like, I think with the timestamps of all submissions, rating modification is always possible (as long as the contest setter intends to do so).
What about if I waited for 30 mins for checking my solution then got WA and realized little bug immediately? 30mins is 1/4 of contest...
Ah... I got it now. I did feel the same thing when waiting for problem D, at least it turned out good (not sure if it could withstand the system tests). But okay, thanks.
i see, but i was going to be an expert if this round is rated
It happens :) Just think what top10 feels now.
BTW, I was going to be expert also :P
For problem F, would it be right to say the following? Construct a new undirected graph where the edges from the input graph are considered as vertices and if any two edges in the input graph are incident on some same vertex, then connect them in the new graph. The vertices from the input graph are not considered in this new graph. Now find the maximum matching in this new graph. This gives the answer. I know this won't work even if it is correct but I just want to know if this reduction is right. Thank you!
This reduction is correct. Nevertheless, it cannot get AC, because in some cases it requires constructing too big graph. For example, imagine a test with n=100000, m=99999 and with edges {1,i} for each i from {2,3,...100000}. Then your sollution needs to contruct a new graph consisting of m*(m-1)/2 = 4999850001 new edges, which is far too much to hold in memory without getting MEM/RTE. Your sollution's expected time complexity is O(m+n+E*logm), where E is the number of edges in new graph, which is enough if E doesn't exceed 10^6. However, due to the fact that E can be O(m^2), pessimistic time complexity of your sollution is O(m^2*logm), which is too slow to be able to pass all tests.
test 43 on Div1C?
My one of the best performance, but unrated :(
me too.
Yes, for me to. It should happen more often, I perform better unrated.
When can we submit the code in Practice. Can not currently :(
Update: We can submit now :')
Apparently Mirzayanov has accidentally rebooted the Practice machines too.
now, finally :)
When will the editorial be posted?
I think I have solutions to everything in Div 1, even though I couldn't get them to work in the contest. Here's the short, short editorial:
A: Greedily extend the current word until adding another letter would violate the condition. Constraints are low enough that you don't have to be particularly clever (I think my solution is O(N^2) even though linear is quite easy).
B: Make a frequency table of how many words contain each substring. You have to be a little careful because a substring might appear twice in one word. Then for each phone number, check every substring in increasing length until you find one that only appears in that number.
C: Make two lists of initial filenames (examples and other), say I0, I1 and target filenames (examples and other), say T0, T1. Any file that already has a valid target name for its type gets crossed off both lists. If I0 == T1 and I1 == T0 then you have to rename some file to a temporary to break the cyclic dependency. After that or otherwise, you can always find some target in T1 \ I0 (or T0 \ I1), and then pick the source from I1 & T0 (or I0 & T1) if not empty, otherwise any from I1. You can prove that applying this renaming is safe and will again allow a subsequent renaming.
D: In each component it's always possible to use half the edges. In fact, it's possible to picks off episodes such that the component remains connected. Build the DFS tree. Where a vertex has two up-edges, combine them into an episode — removing up-edges won't affect the DFS tree. Now pick the deepest leaf, picking one with an up-edge if possible. There are a few cases to consider, but it's always possible to use the edge from the leaf to it's parent plus some other edge in a way that won't disconnect the tree.
E: I'm using a heavy-light decomposition and small-into-large merging. My solution was running out of memory (it turns out a deque per node uses a surprisingly large amount of memory even if they're empty), and I want to check if it's fast enough before posting my approach — I'm not 100% sure it is actually O(N log N).
There is a near-linear solution for E using LCA and a stack.
30443098
Your solution seems to be O(N*sqrt(N)). The code below gives test cases where your solution performs a little over 0.6*N*sqrt(N) calls to push_down. I think that is about the worst you can do, since only the push_down call on the heavy child seems suspect (I think) and because of the merging of light childs before it, it seems a vertex can receive at most O(sqrt(N)) such calls.
Yes, I'd also concluded that my solution is O(N sqrt(N)). Once I fixed the memory usage it passes system tests though, so the tests are probably not that strong. I think the push_down calls can be improved because they'll always operate on a contiguous range of the vertices at each level, so they can be made O(depth of light subtree) rather than O(size of heavy subtree to depth of light subtree).
Rating changes for contest: Div. 1, Div. 2, Технокубок.
Wait a sec, it's unrated....
CF-Predictor makes every contest rated:)
It's awesome but the CF rating doesn't change :(
Sorry, it is not in my power
Does anyone have an O(n log(n)) approach for div1 E ?
Can you please share your approach.Solutions are not public yet.
Yes, me. Also, it is possible to get O(N) if I use LCA in O(N) precomputation and O(1) query, but it's just theory. Add nodes in layers and construct the compressed tree with the current nodes and do some partial sums
When will we be able to see testcases/resubmit? I'm curious about WA76 in Div1C.
I think using O(nlogn) for intended solution in 1E and trying to make O(nlog^2n) can't pass is not a good idea in cf :/
I thought O(nlog^2n) is really fast and submitted without thinking and got TLE in the system test.
UPD: resubmitted the TLE code without editing and got AC :/
i have an issue, my code pass div 2 problem D's pretest, then my code get time limit exceeded on test 3 when system testing, then i resubmit again after system testing, and ac,,, what is going on???
This is quite weird. My answer for div2 A here gives correct answer
30000
for pretest 1 on my system but is giving wrong answer29952
on CF. What can be the reason? Any help is appreciated.pow() returns double, write one that calculates in integral type by your self!
Thanks, that worked.
But here both arguments are integers, then why should returning double be a problem (I am typecasting the result in long long)?
Cause pow(base, exp) = {base}exp = (eln(base))exp = eexp * ln(base)
This is how pow function implemented among almost every C++ compiler. Both functions ln and ex calculate result by Taylor series. So there always will be some error. If you want integral-type based implementation you should do it by yourself.
editorials please?
Can anyone please help in Div2C.I am constantly getting WA on test case 40.Here is my code.
Try this input:
dfacccbabc
Output that you should be getting
dfaccc babc
I am getting "dfacccbabc" when i am running locally.I am not able to get my mistake.
Yeh i get it. That's why i gave this input. So now you know what's your mistake, should be easy to correct i guess.
I can not figure out , why the answer should be dfaccc babc?? Will you please explain?
From what i can figure out this is your mistake-
Once you're getting consecutive consonants which have all the same character you're printing all of them, which you shouldn't. Suppose you've got
cccccba
then printingcccccba
is incorrect as you'll have a substringccb
which is a typo and should have been printedcc b
or rather the whole stringccccc ba
.Hope this helps :'). Haven't looked at you code but i'm guessing this is the mistake.
I submitted my TLE code for D after the contest and it gets AC. Can someone please comment on this?
TLE submission during contest: http://codeforces.me/contest/861/submission/30435774
Submission after the contest: http://codeforces.me/contest/861/submission/30459324
I have got the same result as you do...
TLE during contest: http://codeforces.me/contest/861/submission/30432570
AC just now: http://codeforces.me/contest/861/submission/30459760
probably the server lagged during the contest since there were too many submissions to judge...?
Editorial please!
http://codeforces.me/blog/entry/54604
Thank you! :)