DRGHTS-Editorial

Hmm, I’m getting a wrong answer but can’t seem see, why, some basic tests locally seem to pass, anyone have a some more test cases that I could run my code through?

Here is my current solution that is failing:

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

Edit- Here is another version but still failing:
http://www.codechef.com/viewsolution/3471976

I’m using n*n-1/2 for calculating first answer by checking sub-trees for all “1” nodes.

The second answer I’m counting all leaves with no open windows and subtracting from the number of nodes, with a special case being 1, which I return 0.

Or am I mis-understanding the 2nd question, i.e. there is still a draught even if the room has no openwindow as a long as it is on the path of rooms that have openWindows, even if those rooms are not direct neighbours? So they can be few nodes away?

I solved this problem using a DFS that returns a parameter which tells whether the current node is to be included or not for the answer of 2nd part of the question… The description of my solution is given here

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 …