Problem statement says "His friends write numbers from 1 to N on cards", but it doesn't mention that these numbers should be distinct. Yet, it seems like the problem only accepts solutions in which the numbers are distinct (i.e. the numbers on the N cards are a permutation of [1..N]).
Hint: Try to build bipartite graph with 2*N edges. Then iteratively find vertice with only one connected edge. This edge will be "true" anyhow, so its pair from the guy's statement is "false". Also "false" are all edges, connected to both vertices of current one, and then you can mark their pairs as "true" ans so on...
What residue graph after this procedure. Can it have vertices with deg>2? Logically it must be union of separeted edges(matched vertices) and disjoint circles. But My Ac prog says that in 9 test residue graph has vertice with deg>2.
Potentialy very interesting but with too weak tests problem I got Ac very unexpected on halphway of solution. MY prog can't process test 4 1 2 1 2 1 2 3 4 3 4 3 4 with answer 1 1 1 1 This specific case most interesting case when there are K~100-250 unintersecting circles in given graph. We should build forest consist of such circles and process each tree from the root. Circles are bound throught whome each statement belong. All this situation is unreflected because weak tests.