Hello!
Soon (on October 1 at 19:30 MSK) you are lucky to participate in Codeforces Round #203 for Div. 2 participants. Traditionally, Div. 1 participants can take part out of the competition.
Problems have been prepared by me. I want to thank Gerald Agapov (Gerald) for help in preparation of this round, Ilya Los (IlyaLos) for testing of problems, Alexander Ignatyev (aiMR) for testing of problems and for idea of one of the problems, Michael Mirzayanov (MikeMirzayanov) for marvelous Codeforces and Polygon systems, Mary Belova (Delinur) for translation of statements.
Good luck!
UPD:Scoring will be dynamic. Problems are sorted by increasing order of difficulty.
UPD: Congratulations to winners:
UPD: Editorial
Happy National Day for all Chinese participants!
Wish everyone a high score!
PS: It would be better for us Chinese participants if only start time of each round could be made a little bit earlier...
can't agree more. contests on codeforces always start at Beijing time 23:30 toooooo late...
can't agree more
GL&HF!
I hope this contest don't like last.
whats wrong with the last one? (:
You can surely see my username written in green colour ,can't you !! This is what happened in the last contest :(
So, fingers crossed this time :) (y)
Why is it that registration closes before contest ?? and we can't enter after the contest hast started?
Valid point. But I assume one reason may be challenge phase. If there is no registration there might not be fair and optimal way of room assignment as every body will simply log on at the time of the competition.
R.I.P clarity..
I submitted problem C in Java to get TLE on test case 5. Rewrote the same algorithm in C# and it passed test case 5. That's really not fair. >.<
The problems translations to English needed more work. Also problems A, B & C didn't have any explanation for their sample tests.
Couldn't agree more. I took much time reading description of Problem B and hardly got how sample tests works because of no explanation, but easily understand Problem C by a quick glance.
I think Problem C should be set before Problem B.
i can't understand problem B :(
i have same problem. but i sent a clarify question and understood it. when you cant understand a problem you should send a clarify question. they often send you a compelete answer! sorry for my poor english.
Same here. It was very difficult understanding the problem B. But looking into the submissions in the room, I was skeptical of making my comment. I think we as a community will benefit if the problems are better written.
The same to you!!!
it's the only problems that I solved :lol:
The title of the competition is too difficult to read!!!
Could not submit E on last minute as server was down :-( 5 additional minutes should be granted IMHO
I think some phrase and grammer is difficult to realize for people have poor english like me.
8 successful hacks for problem A with this test case 2 1 3 5 10
From where I can get the tutorials for the contest?
editorials will be published after some time...
I failed to submit my solution for problem C the last second before the end because I can't enter the site.what a pity!
I was in exactly same situation...
15 sec remaining, I submitted problem D but.. the submission was denied..and the contest ends.. :(
problems did not interesting,did not short,did not have sample test explanation,statement was not perfect.
I don't like this contest :) may be becose I wrote badly ;)
E is interesting indeed.
I have no time to read problem E :( i was tryng to translate problem B with my fully english,and to solve problem D becose was thinking that problem D would be easy than problem E as usual time :)
statement says : "a graph without any loops and multiple edges" , what's meaning of loop ??
An edge from one node to itself
"loop" != "cycle" :-| Got it !
Same mistake :\
Same midtake too
A loop is an edge whose both ends are connected to the same vertex.
duh! And C went to 1000..
Scoring should be gradual not sudden like 500-1000-1500 ...
When will ratings be updated???
For Problem C :
My java code gets TLE at test 5 .
This is the Code : http://mirror.codeforces.com/contest/350/submission/4630115
After The contest I changed it to C++ And the same code passes :
This is my C++ code : http://mirror.codeforces.com/contest/350/submission/4632017
Kinda disappointing :/
I think it's because of big amount of
System.out.println()
Maybe I shall use String Builder and append stuff together , but I couldn't get that this is the reason of my TLE. :/
You could try using PrintWriter
PrintWriter out = new PrintWriter( System.out ); // all your prints out.flush() // send your prints to the output
It is faster.
Sorry, there is.
How do you solve it without sorting?
I'm getting the closest points to my starting point to avoid facing a bomb in my way to a far bomb and it goes like that till the end so the condition is satisfied.
Ok, and how do you take the closest point to the origin?
By getting the minimum sum of (x + y) for the bombs points
And isn't it faster to sort the bombs by x+y and then iterate through them? Since it is still not enough to get AC using Java, I don't think that choosing the min(x+y) with O(n) for every bomb works in 2 sec in any language.
Sry I misunderstood you , I was explaining how im sorting them but without sorting Idk how to do it
From problem E:"non-directed connected graph from n vertexes and m edges, containing no loops and multiple edges"
Doesn't this mean that the graph is a tree?
No, loops != circles. No loops simply means that there is no edge from one node to itself.
loop != cycle. loop is an edge from a node to itself
In problem C, can anybody explain to me why this get AC,
while this was not?
Thank you for your reading.
edit: Thanks for reply. I found a test case that make sort() result not correct.
a = (1, 3), b = (-1. -2), c = (1, 2) in my code (1, 3)==(-1,-2), (1, 3) > (1, 2), (-1, -2)==(1, 2) b = a, a > c, b = c → b=a>c=b, so a&c may not sort correctly.
Two dots: (2;10000) and (5;6). First one is definitely more distant than the second.
i got AC with first line of cmp being
if(abs(d1.x) == abs(d2.x))
and second line same as yours above.the Manhattan distance cmp function would also give you AC.
Little tangent, but second cmp ( sort comparison function) is not right.
For both calls, cmp( (5,100), (-5,100)), cmp( (-5,100), (5,100)) it returns true. It breaks transitivity. http://en.wikipedia.org/wiki/Comparison_sort
But I got AC using both sort method above. Why?
Correspondingly,
4639463
4639478
Your compare
return (abs(a.x)==abs(b.x))?(abs(a.y)<abs(b.y)):(abs(a.x)<abs(b.x));
is different to the op. You are checking equality for the abs while op is not.
topped my room for the first time and advanced to Div-1 even though i failed A! :)
P.S. very weak pretests for A!!
Why does my code for Problem B give MLE? I have no idea.
http://mirror.codeforces.com/contest/350/submission/4633434
Looks like recursion depth. May be could not allocate enough stack.
I don't think that is the reason because I do not see any unnecessary recursive calls. It's similar to how others have done it.
Edit : On taking a closer look, I realized that my code is not using a vis[] array hence, there is a possibility of it getting trapped in a cycle which causes stack overflow. You are right. Thanks :)
Failed to get Problem C because I used formula to find gradient instead of the distance formula. All this because I had little time left and rushed everything. Just saw that and corrected the formula to get AC. Absolutely deflated :(
Thanks to the problem setter and testers!!
Hi, I tried debugging my codes but could not find anything wrong. Please help me to find what is wrong with my solutions.
350C - Bombs — solution id 4631490
350B - Resort — solution id 4628087
The test cases are only partially shown so they were of little use.
I think the second test case for problem B is wrong as i got 1-2-4-5 and k=4; while the testcase says 4-5 k=2.Please can someone clarify please.
Got it condition 2 of problem each object must have at most one connection to another object. I'm thinking in line of LIS is my intuition correct?
notice that path 2-4 is invalid as 2-3 also exists. a path is valid if the starting vertex leads to one other vertex only.
thx this contest..I get 246 points.
Problem A, my program got WA on test #24 (expected 4, but got -1). I ran my code on my machine, however, the output was actually 4. I don't know why it got -1 on codeforces (even after I resubmit the code, it was still WA). Here is my contset submission 4621813
The second loop would be REP(i,m) for reading the b[i]'s.
Enjoyed the contest very much.Hacked 8 solutions successfully with the test case 3 1 3 4 5 8
In my opinion, I prefer concice problem description, long description always take nonnative more time to understand, I think the algorithm matches should reduce the differences between native & nonnative.
Problem C's TL should be increased. this tight TL is not fair
Here is my code which at first stocked at test 5 after adding "ios::sync_with_stdio(false)" it passed and again stocked at test 6
here is my submission http://mirror.codeforces.com/contest/350/submission/7048251
just look at the times in AC codes here : http://mirror.codeforces.com/contest/350/status/C
I see there times like 904 ms with python...
By the way, I submitted your code with endls replaced with '\n' and look: http://mirror.codeforces.com/contest/350/submission/7049199 280 ms.
that's interesting ! what a diffrence !
an unrelated question to my first post : what is the diffrence between '\n' and endl ?
thanks in advance