|
0
Is there anyone who could help me to solve this problem or give any other approach.Thanks in advance http://mirror.codeforces.com/blog/entry/46505 |
|
0
Thanks. |
|
0
Any help or what so ever is appreciated . |
|
+6
First find out that there can be any root of the given tree(if any make ans = -1 otherwise 0) ans = -1 is for when you have p[i] == i case , the root of the tree. For every i , check whether (i,p[i]) are from the same set , if it is then make the parent of i as root(if any or create this i as root ) and increment ans each time when you find they are from same set. Here is my code : 19259242 |
|
0
Thanks. |
|
0
Can someone explain me the dp solution for the Div2-C/Div1-A ? |
|
-10
The way the TooDifficult has been improved with past rounds , one day sure he may defeat even Petr and tourist . Waiting to see that happen. |
|
+24
|
|
+2
Hoping to see some good problems and ratings up. All the best to all. |
|
0
Thanks. |
|
0
|
|
+19
|
|
+1
For the pair of strings to find a and b Lets understand that if a&b=1 , then there would be 1 in both. For a&b = 0, it can happen in three ways 00 ,01,10. As number is less than 64 , it can be represented with 6 bits. So you should check the total number of zeros in every number of 6th bit representation. So ans = 3^tot. |
|
0
|
|
0
Thanks. |
|
0
Thanks , But can you tell me with some more explanation or with some sample example? I didn't got it through. |
|
0
Auto comment: topic has been updated by sainiarpit12 (previous revision, new revision, compare). |
|
0
In problem D tourist http://mirror.codeforces.com/contest/611/submission/15107147 Why he(tourist) is adding the value if (i — len >= 0 && !added) { add(sum, dp[i — len][i — 1]); } Thank in advance. |
|
0
Thanks for the explanation |
|
0
In problem D , Can someone explain me the use of nxt[a][b] should be nxt[a+1][b+1] or 0 with some example and why do need it ? Thanks. |
|
0
Why B has numbers from 1 to 2*n -1 ? The problem says only from 1 to n . I didn't understood use of C(2*n-1 , n) .. Any response are welcome . Thanks |
|
0
Thanks a lot !! |
|
0
Can someone explain me this code for Problem D : http://mirror.codeforces.com/contest/552/submission/11636769 I know that he is calculating the equation of the line .. But how trip (variable) is working here and also about ans -= trip/3 .... Thanks in advance :) |