message
stringlengths
2
45.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
254
108k
cluster
float64
3
3
__index_level_0__
int64
508
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achieve...
instruction
0
47,654
3
95,308
Yes
output
1
47,654
3
95,309
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achieve...
instruction
0
47,655
3
95,310
No
output
1
47,655
3
95,311
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achieve...
instruction
0
47,656
3
95,312
No
output
1
47,656
3
95,313
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achieve...
instruction
0
47,657
3
95,314
No
output
1
47,657
3
95,315
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achieve...
instruction
0
47,658
3
95,316
No
output
1
47,658
3
95,317
Provide tags and a correct Python 3 solution for this coding contest problem. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully, there are some stones in the river to help th...
instruction
0
47,659
3
95,318
Tags: binary search, flows, greedy, two pointers Correct Solution: ``` # ---------------------------iye ha aam zindegi--------------------------------------------- import math import random import heapq, bisect import sys from collections import deque, defaultdict from fractions import Fraction import sys import thread...
output
1
47,659
3
95,319
Provide tags and a correct Python 3 solution for this coding contest problem. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully, there are some stones in the river to help th...
instruction
0
47,660
3
95,320
Tags: binary search, flows, greedy, two pointers Correct Solution: ``` def read_nums(): return list(map(int, input().split())) w, l = read_nums() rocks = read_nums() cur_sum = sum(rocks[0: l]) min_sum = cur_sum for i in range(l, len(rocks)): cur_sum -= rocks[i - l] cur_sum += rocks[i] min_sum = min(mi...
output
1
47,660
3
95,321
Provide tags and a correct Python 3 solution for this coding contest problem. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully, there are some stones in the river to help th...
instruction
0
47,661
3
95,322
Tags: binary search, flows, greedy, two pointers Correct Solution: ``` # Author: Sudam Kalpage # College: University of Peradeniya # Date: 15/11/2020 # Contact: sudamkalpag4@gmail.com from math import * from itertools import permutations from itertools import combinations from itertools import combinations_with_replace...
output
1
47,661
3
95,323
Provide tags and a correct Python 3 solution for this coding contest problem. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully, there are some stones in the river to help th...
instruction
0
47,662
3
95,324
Tags: binary search, flows, greedy, two pointers Correct Solution: ``` from collections import Counter import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self...
output
1
47,662
3
95,325
Provide tags and a correct Python 3 solution for this coding contest problem. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully, there are some stones in the river to help th...
instruction
0
47,663
3
95,326
Tags: binary search, flows, greedy, two pointers Correct Solution: ``` w, l = [int(x) for x in input().split()] a = [int(x) for x in input().split()] s = res = sum(a[:l]) for i in range(l, w - 1): s += a[i] - a[i - l] res = min(res, s) print(res) ```
output
1
47,663
3
95,327
Provide tags and a correct Python 3 solution for this coding contest problem. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully, there are some stones in the river to help th...
instruction
0
47,664
3
95,328
Tags: binary search, flows, greedy, two pointers Correct Solution: ``` # D - Single-use Stones w,l = [int(i) for i in input().split(' ')] a = [1E9]*(w+1) entrada = [int(i) for i in input().split(' ')] for i in range (1, w): a[i] = entrada[i-1] aux = [0]*len(a) num = 0 for j in range (1, w+1): if(a[j] <= 0...
output
1
47,664
3
95,329
Provide tags and a correct Python 3 solution for this coding contest problem. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully, there are some stones in the river to help th...
instruction
0
47,665
3
95,330
Tags: binary search, flows, greedy, two pointers Correct Solution: ``` I=lambda:map(int,input().split()) w,l=I() a=list(I()) c=s=sum(a[:l]) for i in range(w-l-1): s=s-a[i]+a[i+l] c=min(c,s) print(c) ```
output
1
47,665
3
95,331
Provide tags and a correct Python 3 solution for this coding contest problem. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully, there are some stones in the river to help th...
instruction
0
47,666
3
95,332
Tags: binary search, flows, greedy, two pointers Correct Solution: ``` # input segment w,l = map(int,input().split()) a=list(map(int,input().split())) # computer minimal segemnt of length l, and a temp variable minsegment=s=sum(a[:l]) # calculate every l segment min value, for i in range(1,w-l): s=s-a[i-1]+a[i+l-...
output
1
47,666
3
95,333
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully...
instruction
0
47,667
3
95,334
Yes
output
1
47,667
3
95,335
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully...
instruction
0
47,668
3
95,336
Yes
output
1
47,668
3
95,337
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully...
instruction
0
47,669
3
95,338
Yes
output
1
47,669
3
95,339
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully...
instruction
0
47,670
3
95,340
Yes
output
1
47,670
3
95,341
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully...
instruction
0
47,671
3
95,342
No
output
1
47,671
3
95,343
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully...
instruction
0
47,672
3
95,344
No
output
1
47,672
3
95,345
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully...
instruction
0
47,673
3
95,346
No
output
1
47,673
3
95,347
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully...
instruction
0
47,674
3
95,348
No
output
1
47,674
3
95,349
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. A of the Aizu Institute of Biological Research discovered a mysterious insect on a certain southern island. The shape is elongated like a hornworm, but since one segment is shaped like a bal...
instruction
0
47,862
3
95,724
Yes
output
1
47,862
3
95,725
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. A of the Aizu Institute of Biological Research discovered a mysterious insect on a certain southern island. The shape is elongated like a hornworm, but since one segment is shaped like a bal...
instruction
0
47,863
3
95,726
No
output
1
47,863
3
95,727
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. A of the Aizu Institute of Biological Research discovered a mysterious insect on a certain southern island. The shape is elongated like a hornworm, but since one segment is shaped like a bal...
instruction
0
47,864
3
95,728
No
output
1
47,864
3
95,729
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. A of the Aizu Institute of Biological Research discovered a mysterious insect on a certain southern island. The shape is elongated like a hornworm, but since one segment is shaped like a bal...
instruction
0
47,865
3
95,730
No
output
1
47,865
3
95,731
Provide a correct Python 3 solution for this coding contest problem. In the good old days, the Internet was free from fears and terrorism. People did not have to worry about any cyber criminals or mad computer scientists. Today, however, you are facing atrocious crackers wherever you are, unless being disconnected. Yo...
instruction
0
47,887
3
95,774
"Correct Solution: ``` # AOJ 1111: Cyber Guardian # Python3 2018.7.15 bal4u import re while True: n, m = map(int, input().split()) if (n|m) == 0: break rule, ans = [], [] for i in range(n): g, s, d = input().split() rule.append((g[0] == 'p', re.compile((s+d).replace("?", "[0-9]")))) for i in range(m): s, d,...
output
1
47,887
3
95,775
Provide a correct Python 3 solution for this coding contest problem. In the good old days, the Internet was free from fears and terrorism. People did not have to worry about any cyber criminals or mad computer scientists. Today, however, you are facing atrocious crackers wherever you are, unless being disconnected. Yo...
instruction
0
47,888
3
95,776
"Correct Solution: ``` # AOJ 1111: Cyber Guardian # Python3 2018.7.15 bal4u import re while True: n, m = map(int, input().split()) if (n|m) == 0: break rule, ans = [], [] for i in range(n): g, s, d = input().split() rule.append((g[0] == 'p', s.replace("?", "[0-9]"), d.replace("?", "[0-9]"))) for i in range(m...
output
1
47,888
3
95,777
Provide a correct Python 3 solution for this coding contest problem. In the good old days, the Internet was free from fears and terrorism. People did not have to worry about any cyber criminals or mad computer scientists. Today, however, you are facing atrocious crackers wherever you are, unless being disconnected. Yo...
instruction
0
47,889
3
95,778
"Correct Solution: ``` # AOJ 1111: Cyber Guardian # Python3 2018.7.15 bal4u import re while True: n, m = map(int, input().split()) if (n|m) == 0: break rule, ans = [], [] for i in range(n): g, s, d = input().split() rule.append((g[0] == 'p', \ re.compile(s.replace("?", "[0-9]")), \ ...
output
1
47,889
3
95,779
Provide a correct Python 3 solution for this coding contest problem. In the good old days, the Internet was free from fears and terrorism. People did not have to worry about any cyber criminals or mad computer scientists. Today, however, you are facing atrocious crackers wherever you are, unless being disconnected. Yo...
instruction
0
47,890
3
95,780
"Correct Solution: ``` # AOJ 1111: Cyber Guardian # Python3 2018.7.15 bal4u import re while True: n, m = map(int, input().split()) if (n|m) == 0: break rule, ans = [], [] for i in range(n): g, s, d = input().split() rule.append((g[0] == 'p', re.compile((s+d).replace("?", "\d")))) for i in range(m): s, d, m...
output
1
47,890
3
95,781
Provide a correct Python 3 solution for this coding contest problem. In the year 2xxx, an expedition team landing on a planet found strange objects made by an ancient species living on that planet. They are transparent boxes containing opaque solid spheres (Figure 1). There are also many lithographs which seem to cont...
instruction
0
47,891
3
95,782
"Correct Solution: ``` from collections import defaultdict, deque import sys readline = sys.stdin.readline write = sys.stdout.write def solve(): N = int(readline()) if N == 0: return False C0 = [list(map(int, readline().split())) for i in range(N)] U = [1]*N D = defaultdict(list) for i i...
output
1
47,891
3
95,783
Provide tags and a correct Python 3 solution for this coding contest problem. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤ j≤ m\}. Two vertices (i_1,j_1) and (i_2, j_2) ...
instruction
0
48,151
3
96,302
Tags: dp, graphs, shortest paths Correct Solution: ``` import sys def get_ints(): return list(map(int, sys.stdin.readline().strip().split())) def print_result(ans): for i in range(len(ans)): print((" ").join(map(str, ans[i]))) def solve(N, M, K, hor, ver): if K & 1: print_result([[-1 for i i...
output
1
48,151
3
96,303
Provide tags and a correct Python 3 solution for this coding contest problem. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤ j≤ m\}. Two vertices (i_1,j_1) and (i_2, j_2) ...
instruction
0
48,152
3
96,304
Tags: dp, graphs, shortest paths Correct Solution: ``` from sys import stdin,stdout from math import gcd,sqrt,factorial,pi,inf from collections import deque,defaultdict from bisect import bisect,bisect_left from time import time from itertools import permutations as per input=stdin.readline R=lambda:map(int,input().spl...
output
1
48,152
3
96,305
Provide tags and a correct Python 3 solution for this coding contest problem. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤ j≤ m\}. Two vertices (i_1,j_1) and (i_2, j_2) ...
instruction
0
48,153
3
96,306
Tags: dp, graphs, shortest paths Correct Solution: ``` from copy import deepcopy def sol(n,m,k,aa,bb): if k&1: return [[-1] * m] * n ans = [[float('inf')]*(m+2) for _ in range(n+2)] k >>= 1 for i in range(1,n+1): for j in range(1,m+1): ans[i][j] = min(aa[i][j], aa[i][j-1], bb...
output
1
48,153
3
96,307
Provide tags and a correct Python 3 solution for this coding contest problem. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤ j≤ m\}. Two vertices (i_1,j_1) and (i_2, j_2) ...
instruction
0
48,154
3
96,308
Tags: dp, graphs, shortest paths Correct Solution: ``` import sys, os if os.environ['USERNAME']=='kissz': inp=open('in.txt','r').readline def debug(*args): print(*args,file=sys.stderr) else: inp=sys.stdin.readline def debug(*args): pass # SCRIPT STARTS HERE n,m,k=map(int,inp().spl...
output
1
48,154
3
96,309
Provide tags and a correct Python 3 solution for this coding contest problem. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤ j≤ m\}. Two vertices (i_1,j_1) and (i_2, j_2) ...
instruction
0
48,155
3
96,310
Tags: dp, graphs, shortest paths Correct Solution: ``` def aburrimin(x, y, n, m, costder, costaba, dp): dists = [] vals = [] if x != 0: # izq dis = costder[y][x-1] dists.append(dis) vals.append(dis+dp[y][x-1]) if y != 0: # arri dis = costaba[y-1][x] dists.append(...
output
1
48,155
3
96,311
Provide tags and a correct Python 3 solution for this coding contest problem. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤ j≤ m\}. Two vertices (i_1,j_1) and (i_2, j_2) ...
instruction
0
48,156
3
96,312
Tags: dp, graphs, shortest paths Correct Solution: ``` from sys import stdin readline = stdin.readline def readInt(): return int(readline()) def readInts(): return list(map(int,readline().split())) U, D, L, R = 0, 1, 2, 3 DIR = [(-1,0), (1,0), (0,-1), (0,1)] n, m, k = readInts() moves = [[[-1 for _ in range(...
output
1
48,156
3
96,313
Provide tags and a correct Python 3 solution for this coding contest problem. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤ j≤ m\}. Two vertices (i_1,j_1) and (i_2, j_2) ...
instruction
0
48,157
3
96,314
Tags: dp, graphs, shortest paths Correct Solution: ``` import sys n,m,k = map(int,input().split()) if k%2: ans = [[-1]*m for _ in range(n)] for row in ans: print(*row) exit() A = [] B = [] inf = float('inf') for _ in range(n): A.append(list(map(int,input().split()))) for _ in range(n-1): B....
output
1
48,157
3
96,315
Provide tags and a correct Python 3 solution for this coding contest problem. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤ j≤ m\}. Two vertices (i_1,j_1) and (i_2, j_2) ...
instruction
0
48,158
3
96,316
Tags: dp, graphs, shortest paths Correct Solution: ``` import sys input = sys.stdin.readline n,m,k=map(int,input().split()) YOKO=[list(map(int,input().split())) for i in range(n)] TATE=[list(map(int,input().split())) for i in range(n-1)] if k%2==1: for i in range(n): print(*[-1]*m) exit() DP=[[0]*m f...
output
1
48,158
3
96,317
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤...
instruction
0
48,159
3
96,318
Yes
output
1
48,159
3
96,319
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤...
instruction
0
48,160
3
96,320
Yes
output
1
48,160
3
96,321
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤...
instruction
0
48,161
3
96,322
Yes
output
1
48,161
3
96,323
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤...
instruction
0
48,162
3
96,324
Yes
output
1
48,162
3
96,325
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤...
instruction
0
48,163
3
96,326
No
output
1
48,163
3
96,327
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤...
instruction
0
48,164
3
96,328
No
output
1
48,164
3
96,329
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤...
instruction
0
48,165
3
96,330
No
output
1
48,165
3
96,331
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are wandering in the explorer space of the 2050 Conference. The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤...
instruction
0
48,166
3
96,332
No
output
1
48,166
3
96,333
Provide tags and a correct Python 3 solution for this coding contest problem. Further research on zombie thought processes yielded interesting results. As we know from the previous problem, the nervous system of a zombie consists of n brains and m brain connectors joining some pairs of brains together. It was observed...
instruction
0
48,402
3
96,804
Tags: dfs and similar, graphs, trees Correct Solution: ``` # https://www.youtube.com/watch?v=_q7aMi-5Uos import sys from collections import defaultdict n,m = list(map(int,sys.stdin.readline().lstrip().rstrip().split())) graph = defaultdict(list) for i in range(m): u,v = list(map(int,sys.stdin.readline().lstrip().r...
output
1
48,402
3
96,805
Provide tags and a correct Python 3 solution for this coding contest problem. Further research on zombie thought processes yielded interesting results. As we know from the previous problem, the nervous system of a zombie consists of n brains and m brain connectors joining some pairs of brains together. It was observed...
instruction
0
48,403
3
96,806
Tags: dfs and similar, graphs, trees Correct Solution: ``` f = lambda: map(int, input().split()) n, m = f() p = [[] for i in range(n)] for j in range(m): a, b = f() p[a - 1].append(b - 1) p[b - 1].append(a - 1) def g(i): u, t = [1] * n, (0, i) s = [t] while s: d, i = s.pop() u[...
output
1
48,403
3
96,807
Provide tags and a correct Python 3 solution for this coding contest problem. Further research on zombie thought processes yielded interesting results. As we know from the previous problem, the nervous system of a zombie consists of n brains and m brain connectors joining some pairs of brains together. It was observed...
instruction
0
48,404
3
96,808
Tags: dfs and similar, graphs, trees Correct Solution: ``` n,m=map(int,input().split()) gr=[[] for i in range(n)] for i in range(m): u,v=map(int,input().split()) gr[v-1].append(u-1) gr[u-1].append(v-1) v=[False for i in range(n)] s=[0] tr={} tr[0]=0 while s: x=s.pop() v[x]=True for j in gr[x]: if v[j]:contin...
output
1
48,404
3
96,809
Provide tags and a correct Python 3 solution for this coding contest problem. Further research on zombie thought processes yielded interesting results. As we know from the previous problem, the nervous system of a zombie consists of n brains and m brain connectors joining some pairs of brains together. It was observed...
instruction
0
48,405
3
96,810
Tags: dfs and similar, graphs, trees Correct Solution: ``` import sys #with open(filename, 'r') as f: with sys.stdin as f: for i, line in enumerate(f): if i == 0: N, M = line.split(' ') N, M = int(N), int(M) graph = [[] for _ in range(N)] # [[]] * N not working, no deepco...
output
1
48,405
3
96,811