DRGHTS-Editorial

Guys can someone please tell me why my solution is being rejected:

http://www.codechef.com/viewsolution/3482076

I can’t see what’s wrong with it. I’m using the method of counting no of 1-label nodes in a tree for answer to 1 and pruning for the answer to 2.

I would really like to get some closure on this. Is my method of printing the answer somehow not being accepted?

plz post the tester’s and setter’s solution asap.

Could anyone tell me what the heck is wrong with my solution?

http://www.codechef.com/viewsolution/3498164

please tell me what is wrong with the sol

what is to be done after calculating I[] of all nodes??
Plz somebody help
This is my after reading this editorial
http://www.codechef.com/viewsolution/3931123
it is giving WA

In this paragraph : “For this we make the tree rooted at some node r, …”(5th paragraph in EXPLANATION) What is “w” ?

It’s a generic node as defined in the previous paragraph. We need to iterate over all nodes w in the tree.

What do you mean by “reverse topological order” ?Please explain.

I used the same approach. I removed all such leaves iteratively :slight_smile: CodeChef: Practical coding for everyone

Hm, I think now it’s clear to me…

Why there is not a better test case ? :’-(

Rubik’s answer is not n. As stated by @anton_lunyov in the contest “After solving the problem I could assert that draught is passing through the room if and only if this room lies on the path between two different rooms with open windows (regardless of whether it has open window or not). Regarding Furik question, it is clear enough: the pair of rooms should be counted if and only if they are connected and both have open windows.”

1 Like

This means a node should be visited only after all its children have been visited.

That shows that I’m an ignoramus, I read that comment, but somehow ignored it :frowning:

how to check the third case

You already have the I() values of all children of a node, just check if there are two or more children have nonzero I() value.

Actually the language of problem was very confusing. I also had 28 WA. Then I read this comment and it helped a lot :slight_smile: Thanks to @anton_lunyov

Actually i was able to solve it because of @anton_lunyov comment.Before that i interpreted as u @betlista .For me problem statement was confusing.

@sambuddha - You did everything right … the only problem(the same i had) is that we forgot to explicit typecast the count to long long which cost me around 20 WA’s … here’s your AC solution which i tried
just modified the tot_count

http://www.codechef.com/viewsolution/3437568

… even though i found the problem i have no clue as to why it happens … if you have any idea please share it with me …

count is int and multiplying count by count is an integer that overflows integer value…although you are putting it up in long long variable but count*count is still int

1 Like

Thanks for the explanation … that was one big mistake.

1 Like