@@ -87,7 +87,25 @@ print(a)`,
8787 "tags.txt" : "dfs and similar\\ngraphs\\ntrees" ,
8888 "tests/" : {
8989 "input_1.txt" : "7 1\\n1 0 1 1 0 0 0\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n3 7" ,
90- "output_1.txt" : "2"
90+ "output_1.txt" : "2" ,
91+ "input_2.txt" : "4 1\\n1 1 0 0\\n1 2\\n1 3\\n1 4" ,
92+ "output_2.txt" : "2" ,
93+ "input_3.txt" : "5 2\\n1 1 0 1 1\\n1 2\\n2 3\\n3 4\\n4 5" ,
94+ "output_3.txt" : "1" ,
95+ "input_4.txt" : "6 1\\n1 0 1 1 0 0\\n1 2\\n1 3\\n1 4\\n1 5\\n1 6" ,
96+ "output_4.txt" : "3" ,
97+ "input_5.txt" : "2 1\\n1 1\\n2 1" ,
98+ "output_5.txt" : "0" ,
99+ "input_6.txt" : "3 2\\n1 1 1\\n1 2\\n2 3" ,
100+ "output_6.txt" : "0" ,
101+ "input_7.txt" : "12 3\\n1 0 1 0 1 1 1 1 0 0 0 0\\n6 7\\n12 1\\n9 7\\n1 4\\n10 7\\n7 1\\n11 8\\n5 1\\n3 7\\n5 8\\n4 2" ,
102+ "output_7.txt" : "7" ,
103+ "input_8.txt" : "15 2\\n1 0 1 0 1 0 0 0 0 0 0 0 0 0 0\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n3 7\\n4 8\\n4 9\\n5 10\\n5 11\\n6 12\\n6 13\\n7 14\\n7 15" ,
104+ "output_8.txt" : "8" ,
105+ "input_9.txt" : "7 3\\n1 1 1 1 1 0 1\\n1 2\\n1 3\\n2 4\\n3 5\\n5 6\\n6 7" ,
106+ "output_9.txt" : "2" ,
107+ "input_10.txt" : "6 1\\n1 0 1 1 0 0\\n1 2\\n2 3\\n1 4\\n1 5\\n1 6" ,
108+ "output_10.txt" : "3"
91109 }
92110 } ,
93111
@@ -158,7 +176,29 @@ for i in range(n):
158176
159177
160178print(max([findDepth(a, i) for i in roots]))` ,
161- "tags.txt" : "dfs and similar\\ngraphs\\ntrees"
179+ "tags.txt" : "dfs and similar\\ngraphs\\ntrees" ,
180+ "tests/" : {
181+ "input_1.txt" : "5\\n-1\\n1\\n2\\n1\\n-1" ,
182+ "output_1.txt" : "3" ,
183+ "input_2.txt" : "12\\n-1\\n8\\n9\\n-1\\n4\\n2\\n11\\n1\\n-1\\n6\\n-1\\n10" ,
184+ "output_2.txt" : "6" ,
185+ "input_3.txt" : "5\\n4\\n5\\n1\\n-1\\n4" ,
186+ "output_3.txt" : "3" ,
187+ "input_4.txt" : "12\\n-1\\n9\\n11\\n6\\n6\\n-1\\n6\\n3\\n8\\n6\\n1\\n6" ,
188+ "output_4.txt" : "6" ,
189+ "input_5.txt" : "4\\n-1\\n1\\n2\\n3" ,
190+ "output_5.txt" : "4" ,
191+ "input_6.txt" : "12\\n3\\n8\\n9\\n12\\n2\\n8\\n11\\n12\\n2\\n9\\n-1\\n11" ,
192+ "output_6.txt" : "7" ,
193+ "input_7.txt" : "5\\n2\\n3\\n4\\n5\\n-1" ,
194+ "output_7.txt" : "5" ,
195+ "input_8.txt" : "12\\n-1\\n-1\\n-1\\n-1\\n-1\\n-1\\n-1\\n-1\\n-1\\n-1\\n-1\\n-1" ,
196+ "output_8.txt" : "1" ,
197+ "input_9.txt" : "12\\n-1\\n1\\n1\\n1\\n1\\n1\\n3\\n4\\n3\\n3\\n4\\n7" ,
198+ "output_9.txt" : "4" ,
199+ "input_10.txt" : "3\\n-1\\n1\\n1" ,
200+ "output_10.txt" : "2"
201+ }
162202 } ,
163203
164204 "292_b_network_topology_9930/" : {
@@ -207,7 +247,29 @@ elif c1==n-1 and cs==1:
207247 print("star topology")
208248else:
209249 print("unknown topology")` ,
210- "tags.txt" : "graphs\\nimplementation"
250+ "tags.txt" : "graphs\\nimplementation" ,
251+ "tests/" : {
252+ "input_1.txt" : "4 3\\n1 2\\n2 3\\n3 4" ,
253+ "output_1.txt" : "bus topology" ,
254+ "input_2.txt" : "4 4\\n1 2\\n2 3\\n3 4\\n4 1" ,
255+ "output_2.txt" : "ring topology" ,
256+ "input_3.txt" : "4 4\\n1 2\\n2 3\\n3 1\\n1 4" ,
257+ "output_3.txt" : "unknown topology" ,
258+ "input_4.txt" : "4 3\\n1 2\\n1 3\\n1 4" ,
259+ "output_4.txt" : "star topology" ,
260+ "input_5.txt" : "4 4\\n1 2\\n2 3\\n3 4\\n4 2" ,
261+ "output_5.txt" : "unknown topology" ,
262+ "input_6.txt" : "10 9\\n10 6\\n3 4\\n8 9\\n8 4\\n6 1\\n2 9\\n5 1\\n7 5\\n10 3" ,
263+ "output_6.txt" : "bus topology" ,
264+ "input_7.txt" : "10 14\\n3 2\\n7 2\\n6 4\\n8 1\\n3 9\\n5 6\\n6 3\\n4 1\\n2 5\\n7 10\\n9 5\\n7 1\\n8 10\\n3 4" ,
265+ "output_7.txt" : "unknown topology" ,
266+ "input_8.txt" : "6 6\\n1 2\\n2 3\\n3 1\\n4 5\\n5 6\\n6 1" ,
267+ "output_8.txt" : "unknown topology" ,
268+ "input_9.txt" : "4 3\\n2 4\\n1 3\\n4 1" ,
269+ "output_9.txt" : "bus topology" ,
270+ "input_10.txt" : "5 4\\n4 2\\n5 2\\n1 2\\n2 3" ,
271+ "output_10.txt" : "star topology"
272+ }
211273 } ,
212274
213275 "913_b_christmas_spruce_7977/" : {
@@ -258,7 +320,29 @@ if __name__ == '__main__':
258320 exit()
259321
260322 print("Yes")` ,
261- "tags.txt" : "implementation\\ntrees"
323+ "tags.txt" : "implementation\\ntrees" ,
324+ "tests/" : {
325+ "input_1.txt" : "4\\n1\\n1\\n1" ,
326+ "output_1.txt" : "Yes" ,
327+ "input_2.txt" : "8\\n1\\n1\\n1\\n1\\n3\\n3\\n3" ,
328+ "output_2.txt" : "Yes" ,
329+ "input_3.txt" : "7\\n1\\n1\\n1\\n2\\n2\\n2" ,
330+ "output_3.txt" : "No" ,
331+ "input_4.txt" : "7\\n1\\n1\\n1\\n3\\n3\\n3" ,
332+ "output_4.txt" : "No" ,
333+ "input_5.txt" : "3\\n1\\n1" ,
334+ "output_5.txt" : "No" ,
335+ "input_6.txt" : "12\\n1\\n1\\n1\\n2\\n5\\n5\\n5\\n5\\n1\\n2\\n2" ,
336+ "output_6.txt" : "No" ,
337+ "input_7.txt" : "13\\n1\\n2\\n2\\n2\\n1\\n6\\n6\\n6\\n1\\n10\\n10\\n10" ,
338+ "output_7.txt" : "No" ,
339+ "input_8.txt" : "9\\n1\\n1\\n1\\n1\\n2\\n6\\n6\\n6" ,
340+ "output_8.txt" : "No" ,
341+ "input_9.txt" : "20\\n1\\n1\\n1\\n1\\n2\\n2\\n2\\n3\\n3\\n3\\n4\\n4\\n4\\n5\\n5\\n5\\n1\\n1\\n1" ,
342+ "output_9.txt" : "Yes" ,
343+ "input_10.txt" : "8\\n1\\n1\\n1\\n1\\n5\\n5\\n5" ,
344+ "output_10.txt" : "Yes"
345+ }
262346 } ,
263347
264348 "982_c_cut_em_all_5275/" : {
@@ -318,7 +402,29 @@ threading.stack_size(10 ** 8)
318402t = threading.Thread(target=main)
319403t.start()
320404t.join()` ,
321- "tags.txt" : "dfs and similar\\ndp\\ngraphs\\ngreedy\\ntrees"
405+ "tags.txt" : "dfs and similar\\ndp\\ngraphs\\ngreedy\\ntrees" ,
406+ "tests/" : {
407+ "input_1.txt" : "4\\n2 4\\n4 1\\n3 1" ,
408+ "output_1.txt" : "1" ,
409+ "input_2.txt" : "2\\n1 2" ,
410+ "output_2.txt" : "0" ,
411+ "input_3.txt" : "10\\n7 1\\n8 4\\n8 10\\n4 7\\n6 5\\n9 3\\n3 5\\n2 10\\n2 5" ,
412+ "output_3.txt" : "4" ,
413+ "input_4.txt" : "3\\n1 2\\n1 3" ,
414+ "output_4.txt" : "-1" ,
415+ "input_5.txt" : "1" ,
416+ "output_5.txt" : "-1" ,
417+ "input_6.txt" : "4\\n1 2\\n1 3\\n1 4" ,
418+ "output_6.txt" : "0" ,
419+ "input_7.txt" : "10\\n7 1\\n8 4\\n8 10\\n4 7\\n6 10\\n9 3\\n3 5\\n2 10\\n2 5" ,
420+ "output_7.txt" : "4" ,
421+ "input_8.txt" : "4\\n2 4\\n2 1\\n3 1" ,
422+ "output_8.txt" : "1" ,
423+ "input_9.txt" : "4\\n2 4\\n2 1\\n3 2" ,
424+ "output_9.txt" : "0" ,
425+ "input_10.txt" : "3\\n1 2\\n2 3" ,
426+ "output_10.txt" : "-1"
427+ }
322428 }
323429 } ;
324430
0 commit comments