National High School Programming Contest 2020 - Mock Contest

Schedule

The contest will start on 2020-06-24T04:00:00Z and will run for 3 hours.

Click here to learn more about this contest.

when username and password of Toph will given?

2 Likes

No username and password for mock contest.

Can you give the answer of the questions

Hello Sir/Madam . Could someone please point out the “Runtime Error” in the code for Problem C in Python 3.7:

a = input().split() 
n = int(a[0])
m = int(a[1])
nodes = {}
for x in range(1, n + 1):
    nodes[x] = []
for x in range(m):
	a = input().split()
	n1 = int(a[0])
	n2 = int(a[1])
	nodes[n1].append(n2)
	nodes[n2].append(n1)
queries = int(input())
def find(a, b):
	temp = 0
	if b != 1:
		for val in a:
			temp += find(nodes[val], b - 1)
	else:
		temp += len(a)
	return temp
todo = []
for x in range(1, queries + 1):
	todo.append(int(input()))
for x in range(1, queries + 1):
	print(f"Query {x}:")
	k = todo[x - 1]
	for y in range(1, n + 1):
		print(find(nodes[y], k) % 1000000007)

Thank you so much!