0
Since there are u+v numbers which are not small then x, x appears if and only if the first of the u+v numbers is equal to x. There are u numbers same as x, the probability is u/(u+v) 
0
Ok, thank u. 
0
inv[i] is the modular inverse of number i and ifac[i] is the modular inverse of i! (i factorial). You can learn about it on the internet. It is the way of calculating combinations for large numbers. 
0
can u tell me what inv[] and ifac[] mean ? 
0
template 2 isn't fine:

+5
Do you mean 
0
Thanks for your time. Got it. :) 
0
why the "probability" for this is u/(u+v)? isnt it u!*v!/((u+v)!)? 
0
Auto comment: topic has been updated by PikMike (previous revision, new revision, compare). 
Created or updated the text 
0
I think you misunderstood the task: You are given two integers n and m. You have to construct an mfree square matrix of size n × n such that the number of 1's in this matrix is maximum possible. Print the maximum possible number of 1's in such matrix. meaning that values in matrix must be arranged so that the number of 1's is maximum. For example, for n = 5 and m = 4 the maximum would be 24 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 So, your solution is undermining the word "maximum". For 21 one of the answers might be n = 5 and m = 2 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 
0
Because we need to maximise the number of 1s. Therefore, the input 5 4 will likely generate a matrix like this
which have 24 1s. Indeed, if the problem asks for 24 instead, then 5 4 will be a correct solution. 
0
not "a" but all such 4X4 squares should be with atleast 1 zero 
0
In Question C, for input = 21, why isnt "5 4" a valid solution? Suppose we have a 5X5 square with all 1s except on the 4 corners where we have 0s, then if I have to select a 4X4 squares, there are 4 squares of 4X4 I can choose and each of them would contain a 0. Please correct me if I'm wrong, help is appreciated. 
+5
If we can hack with t over 1,we have to wait much more time for the system test. 
0
I do want the editorials too. 
0
minimum value, x will be at least that much, in other cases when m = 3,etc. x will be even more 
0
minimum value of x or maximum value of x? 
+4
Why are those solutions slow, are they doing more than sqrt(10**9) operations? 
0
I was wrong. I think they are fine. Just need few more brackets to be sure. Personally i think it might give speed up to people who make typo when trying to type faster (like me). Those typos sometimes irritates and takes brain bandwidth. 
+1
The system test is really weak and we are forbided to hack with t over 1.I think that shall be a point for hacking 
+4
If you try to use a case in which t=100 and all x=1000000000 in CUSTOM INVOCATION, then you will find an amount of solutions in problem C will get time limit at the last of sorted by Execution Time 
0
yes, only for div2 
0
You are a litter bit unlucky,bother. :D 
0
Yes,I see. 
0
seems it is working now... 
0
is it rated?? 
0
Holly Dijkstra, nobody hacked my D! For one second I did dijkstras from the cheapest cities, and in the other second I did iterations of bellman ford. 
+6
When will the system test begin? 
0
How it can be replaced by templates? 1) something like
imho isn't simpler than just for() 2) I have no ideas how to make same with templates (I don't use such macros, I don't think they give speedup) 
0
To be absolutely sure, i think. Another example, when string has not more than 1e6 chars, many create char[100005]; 
0
what about the rating for div2? 
0
Can u write the tutorial for this Ed.Round please I don't understand in which moment I should stop search the answer and write "1" (938C  Constructing Tests). Could somebody help me with it? 
0
When will the editorials be published ? 
+5

0
Can you explain the equation: 
+35
So when will the rating change?The next contest is coming soon.And the editorial hasn't been published either. 
6
Just try it once for the sake of it. Braces should be on seperate lines in your entire code. feel free to downvote if it doesn't work. Worked for me though :) 
0
What???!!! :D Ok, we'll change the coding style too, if that's the issue. :D Thanks for your valuable suggestion. 
+4
I really wonder who that person is. 
0
I faced a similar problem, here is a verified solution: It happens when you write like this: some code{ } instead write this way  some code { } It may appear silly, but it works, see it for yourself. 
0
Will tell them to use this trick. Thanks 
0
why aren't you using templates, this can lead to bugs which will waste time at the least. 
+10
that's a solution, but that would consume people's time and then after that make it unrated. Like I wouldn't want to participate if it's unrated for me, but it's hard for me to decide now, since I don't know whether it would be rated. 
0
its good to be frustrated. use that energy next time. 
0
It happens to me when i go back and forth after putting a hack testcase for someone. To fix that, i copy url, close the tab. reopen in tab and paste url. on the surface it seems once a pub sub connection is opened in a tab, it doesn't allow new connections unless old one is closed. I havent investigated much though. 
+19
If the ratings aren't updated before the contest, one possible solution is to evaluate the ratings of Education CF Round and then make it unrated for the people who became Div 1 in that round. 
+46
Here comes "Codeforces Round #464 (Div. 2)" and the ratings haven't been updated yet. So what will happen if some 1800rating person who should gain +200 rating in the last round takes part in the #464? 
0
Ohhh, ok, thank you very much!!! Now i got it. 
+4
You can usually expect tutorial no later than 24 hours after the end of the contest (coding phase in this case). 
0
when will be the tutorials be published for this contest? 
+16
AFAIK In every educational rounds after Hacking phase it says 
0
Well I don't think so. It's super easy, especially compared with round #462... 
+18
But the bad news is that the system test hasn't begun yet... There are still only two test cases for problem C. According to the rules, all the hacks will be added into test data and rejudge. I'm wondering why it's called final standings instead of current ones... 
+29
emmm..when will the rating change? Next contest will come. 
+6
You may create one "new" vertex and conect it with all other vertices puting the walue of the road equal to a[i]. Then run Dijkstra algo from it. And it will work N*logM. 
+4
Excuse me but where did you define 
+3
NoTalentBug you make unnecessary vertex run(n^2), look my solve Example:
(Sorry for bad english)

0
more problems you solve, more you will able to find the logic behind a problem. Again don't think that you are not CM or expert. 
+37
Where is the system test? 
0
Your solution does't work with two components. Try this test 4 2 Answer must be 1 3 1 3 P.S. Sorry,false alarm. Didn't read code correctly. 
0
Yes, Rating doesnt matter, but i cant find the simple error and i make many silly mistakes and if a new problem comes, only if i ve already seen it previously, i can solve it, else i cant. I dont know how many problems i need to see. I ve already seen more than 1500 to 2000 problems, and still not a CM or even expert, as i ll go down now. 
+7
You can check the single vertex up to n times. If this vertex has degree n, you have O(n^{2}) operations. 
0
Ahh the hacks will be added to everybody ? Sorry I did not know that. Good to know ! 
+3
0x3f3f3f3f I think. 
+31
Will the system testing and rating update happen before the next contest starts? 
0
Your output for 3 is 1, but correct output should be 2 2. 
+9
There will be system testing brother. All the hack cases will be added and the solutions will be rejudged. 
20
There is no system testing. These are the final results. Now we are just waiting for the rating. (THE ABOVE INFO IS WRONG !!!) Sorry for that! 
+8
Where is the system testing? 
0
Waiting for rating?? mr.Spring 
+3
http://codeforces.com/contest/938/submission/35361791 Can i know why i got hacked in TLE (prob.D) ? with dijkstra? PS. What a newbie's mistake !! everybody thank you !! 
0
That's because the numbers which are larger than x should appear after at least one x,but the numbers which are smaller than x could appear anywhere.So you have to location the smaller numbers,which're (c is the size of smaller numbers),and c! for every permutation,then the larger numbers(or equal numbers) should fill the last positions,which is (n  c  1)!,and the position for x is settled. 
+1
Of course,SPFA is always unstable. 
+3
It took me a while but I found the mistake. In the edge loop inside the while you put the weight into a variable that is declared as int, that makes it overflow and possibly means an negative loop so it makes sense that it is MLE. http://codeforces.com/contest/938/submission/35380385 
0
In problem D, why my solution that uses SPFA got TLE in the last test(test17), is it a requisite to use dijkstra to calculate the minimum route in this problem? 
0
use normal array for dist[] and link list for edges instead of vector? 
0
The last was a bit difficult 
0
Very elegant solution! Thanks a loot. 
0
thank you very much 
+15
We should find such n and m, that 
+7
I need to solve x = u^2 — v^2 = (u — v) * (u + v). So I factor x into 2 factors. But not all factors produce integer u and v. I can restore integer u and v from factors f1 = u — v and f2 = u + v if and only if f1 equals f2 modulo 2. Since the answer of the problem equals n^2 — [n / m]^2, I have n = u and can restore m from v. 
0
hi, could you explain your solution for C? i see many solutions that use 
0
Thanks :) 
+4
Tests are visible after the end of hacking phase. 
0
Good to know. Thanks! 
0

0
When we'll be able to see tests on which solution was hacked? 
0
My (really ugly) code of that complexity passed in under 700ms. http://codeforces.com/contest/938/submission/35374477. It'd be fun if someone hacked it :D 
+2
No, hacking in educational rounds doesn't increase nor decrease your points. 
+2
Let's say a concert is a vertex. Create the graph that the problem gives to you but with weights doubled. Also, create edges from the concert to vertex i with weight a[i]. The distance between the concert and vertex i is exactly what you want so just start from the concert. 
0
why do you need 
0
No no I know the algorithm very well, I also thought about using it in the contest, but I have no idea HOW to do it for every node I'll find out.. Thanks a lot, you've been very helpful :D 
0
Can anyone tell me what's wrong with my approach for D.link to my solution 
+1
cmon, i know you can do it by yourself, don't spam :) It is a simple algorithm, easier than Kruskal's or Prim :) 
0
MST for MinimumST. I still don't see where it doesnt work. Anyway, can you elaborate more? How do I apply Dijkstra on the graph? 
+5
But if the graph is not connected. then we cannot do better than O(logC*logC) for merging two guass right?? 
0

0
Can someone hack my solution for D? I sort edges, then I look at every edge and try to improve answer for every verticle: If I have an edge from a to b which costs d, and ans[a] > ans[b], I make ans[a] = min(ans[a], ans[b] + 2 * d); ans[b] = min(ans[b], ans[a] + 2 * d) otherwise. I do this stuff 50 times, then output the ans array. Sorry for my english btw. 
0
Hahahahahaha 
Name 
