Sort 11 Discussions, By:
Please Login in order to post a comment
Here's how I did in all languages Java 8 , C++ , C , Python 3, Python 2.
N = int(sys.stdin.readline())
M = 
G = 
for i in range(3):
G.append([set() for _ in range(N)])
for _ in range(M[i]):
u, v = map(int, sys.stdin.readline().split())
u, v = u - 1, v - 1
cpt = 0
for a in range(N):
for b in G[a]:
for c in G[b]:
if a in G[c]:
cpt += 1
Its impossible to complete in c# without modfying the process of reading data from console (one must modify Main method)
In the task description it is written that:
But in the sample input the second graph is the following:
Which contains a cycle.
What am I misunderstanding?
I would really appriciate some help.
Are there not 6 possible triples on the sample input?