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
Provide tags and a correct Python 3 solution for this coding contest problem. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can connect charger to a joystick only at the beginning ...
instruction
0
17,261
3
34,522
Tags: dp, greedy, implementation, math Correct Solution: ``` first, second= map(int, input().split()) count = 0 while first>0 and second>1 or second>0 and first>1: if first < second: first+=1 second-=2 else: first-=2 second+=1 count+=1 print(count) ```
output
1
17,261
3
34,523
Provide tags and a correct Python 3 solution for this coding contest problem. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can connect charger to a joystick only at the beginning ...
instruction
0
17,262
3
34,524
Tags: dp, greedy, implementation, math Correct Solution: ``` a1,a2 = map(int,input().split()) k=0 while a1>0 and a2>0 and (a1>1 or a2>1): if a1>a2: a2+=1 a1-=2 else: a1+=1 a2-=2 k+=1 print(k) ```
output
1
17,262
3
34,525
Provide tags and a correct Python 3 solution for this coding contest problem. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can connect charger to a joystick only at the beginning ...
instruction
0
17,263
3
34,526
Tags: dp, greedy, implementation, math Correct Solution: ``` def fun(a, b): if a <= 1 and b <= 1: return 0 a, b = min(a, b), max(a, b) cnt = 0 while abs(a - b) > 1: a += 1 b -= 2 cnt += 1 return cnt + 2 * ((a + b - 1) // 2) - 1 a, b = map(int, input().split()) print(...
output
1
17,263
3
34,527
Provide tags and a correct Python 3 solution for this coding contest problem. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can connect charger to a joystick only at the beginning ...
instruction
0
17,264
3
34,528
Tags: dp, greedy, implementation, math Correct Solution: ``` a1, a2 = [int(x) for x in input().split(' ')] mins = 0 while a1 > 0 and a2 > 0: if a1 == 1 and a2 == 1: break mins += 1 if a1 == min(a1,a2): a1 += 1 a2 -= 2 else: a2 += 1 a1 -= 2 print(mins) ...
output
1
17,264
3
34,529
Provide tags and a correct Python 3 solution for this coding contest problem. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can connect charger to a joystick only at the beginning ...
instruction
0
17,265
3
34,530
Tags: dp, greedy, implementation, math Correct Solution: ``` def fun(): a, b = input().split() a = int(a) b = int(b) t = 0 if(a==1 and b==1): return 0 while (1): if (a <= 0 or b <= 0): return t if (a < b): a += 1 b -= 2 t +=...
output
1
17,265
3
34,531
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can conne...
instruction
0
17,266
3
34,532
Yes
output
1
17,266
3
34,533
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can conne...
instruction
0
17,267
3
34,534
Yes
output
1
17,267
3
34,535
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can conne...
instruction
0
17,268
3
34,536
Yes
output
1
17,268
3
34,537
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can conne...
instruction
0
17,269
3
34,538
Yes
output
1
17,269
3
34,539
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can conne...
instruction
0
17,270
3
34,540
No
output
1
17,270
3
34,541
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can conne...
instruction
0
17,271
3
34,542
No
output
1
17,271
3
34,543
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can conne...
instruction
0
17,272
3
34,544
No
output
1
17,272
3
34,545
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can conne...
instruction
0
17,273
3
34,546
No
output
1
17,273
3
34,547
Provide a correct Python 3 solution for this coding contest problem. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south-pointing arrow * Tile with a north-pointing arrow * Til...
instruction
0
17,604
3
35,208
"Correct Solution: ``` X, Y = map(int, input().split()) while (X !=0 and Y != 0): Slist = [] for i in range(X): S = list(map(str, input())) Slist.append(S) store = [(0,0)] x = 0 y = 0 while True: if (Slist[x][y] == '>'): y += 1 elif (Slist[x][y] == '<'...
output
1
17,604
3
35,209
Provide a correct Python 3 solution for this coding contest problem. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south-pointing arrow * Tile with a north-pointing arrow * Til...
instruction
0
17,605
3
35,210
"Correct Solution: ``` STATE = { "NOTHING": ".", "LOOP": "E" } DIRECT = { ">": [0, 1], "<": [0, -1], "^": [-1, 0], "v": [1, 0] } output = [] while True: width, height = [int(item) for item in input().split(" ")] if width == 0 and height == 0: break tiles = [] for lp...
output
1
17,605
3
35,211
Provide a correct Python 3 solution for this coding contest problem. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south-pointing arrow * Tile with a north-pointing arrow * Til...
instruction
0
17,606
3
35,212
"Correct Solution: ``` import heapq from collections import deque from enum import Enum import sys import math from _heapq import heappush, heappop import copy BIG_NUM = 2000000000 HUGE_NUM = 99999999999999999 MOD = 1000000007 EPS = 0.000000001 sys.setrecursionlimit(100000) North = 0 East = 1 South = 2 West = ...
output
1
17,606
3
35,213
Provide a correct Python 3 solution for this coding contest problem. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south-pointing arrow * Tile with a north-pointing arrow * Til...
instruction
0
17,607
3
35,214
"Correct Solution: ``` def search(table, visited, x, y): if visited[x][y]: print("LOOP") return visited[x][y] = True if table[x][y] == ">": search(table, visited, x, y+1) elif table[x][y] == "v": search(table, visited, x+1, y) elif table[x][y] == "^": search...
output
1
17,607
3
35,215
Provide a correct Python 3 solution for this coding contest problem. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south-pointing arrow * Tile with a north-pointing arrow * Til...
instruction
0
17,608
3
35,216
"Correct Solution: ``` while True: h, w = map(int, input().split()) if h == w == 0: break maze = [input() for i in range(h)] now_x = now_y = 0 is_used = [[False for j in range(w)] for i in range(h)] is_used[0][0] = True while True: now = maze[now_y][now_x] if now == ...
output
1
17,608
3
35,217
Provide a correct Python 3 solution for this coding contest problem. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south-pointing arrow * Tile with a north-pointing arrow * Til...
instruction
0
17,609
3
35,218
"Correct Solution: ``` def run_magic_tiles(magic_tiles, past_matrix): i, j = 0, 0 while True: move = { '^': (-1, 0), 'v': (1, 0), '<': (0, -1), '>': (0, 1), '.': (-1, -1) }.get(magic_tiles[i][j]) if move[0] == -1 and move[1] == ...
output
1
17,609
3
35,219
Provide a correct Python 3 solution for this coding contest problem. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south-pointing arrow * Tile with a north-pointing arrow * Til...
instruction
0
17,610
3
35,220
"Correct Solution: ``` while 1: H,W=map(int,input().split()) if H==0:break m=[input()for _ in[0]*H] y=x=0 for _ in range(H*W): u,v=x,y c=m[y][x] if c=='>':x+=1; if c=='v':y+=1; if c=='<':x-=1; if c=='^':y-=1; if c=='.':print(x,y);break else:print('LOOP') ```
output
1
17,610
3
35,221
Provide a correct Python 3 solution for this coding contest problem. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south-pointing arrow * Tile with a north-pointing arrow * Til...
instruction
0
17,611
3
35,222
"Correct Solution: ``` while 1: h,w=map(int,input().split()) if w==0:break a=[input() for _ in[0]*h] b=[(0,0)];i=j=0 while a[i][j]!='.': if a[i][j]=='>':j+=1 elif a[i][j]=='<':j-=1 elif a[i][j]=='v':i+=1 elif a[i][j]=='^':i-=1 if (i,j) in b:print('LOOP');break...
output
1
17,611
3
35,223
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south...
instruction
0
17,612
3
35,224
Yes
output
1
17,612
3
35,225
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south...
instruction
0
17,613
3
35,226
Yes
output
1
17,613
3
35,227
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south...
instruction
0
17,614
3
35,228
Yes
output
1
17,614
3
35,229
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south...
instruction
0
17,615
3
35,230
Yes
output
1
17,615
3
35,231
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south...
instruction
0
17,616
3
35,232
No
output
1
17,616
3
35,233
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south...
instruction
0
17,617
3
35,234
No
output
1
17,617
3
35,235
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south...
instruction
0
17,618
3
35,236
No
output
1
17,618
3
35,237
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles: * Tile with a east-pointing arrow * Tile with a west-pointing arrow * Tile with a south...
instruction
0
17,619
3
35,238
No
output
1
17,619
3
35,239
Provide tags and a correct Python 3 solution for this coding contest problem. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0), respectively. Circles with numbers from m + ...
instruction
0
17,995
3
35,990
Tags: math Correct Solution: ``` #!/usr/bin/env python3 from math import sqrt m, r = map(int,input().split()) acc = 0.0 for i in range(m): acc += 2*r for j in [i,m-i-1]: if j: acc += (2 + sqrt(2)) * r acc += (2*(j-1)*j/2 + 2*sqrt(2)*(j-1)) * r print('%.12f' % (acc/(m**2))) ```
output
1
17,995
3
35,991
Provide tags and a correct Python 3 solution for this coding contest problem. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0), respectively. Circles with numbers from m + ...
instruction
0
17,996
3
35,992
Tags: math Correct Solution: ``` m,R=map(int, input().split()) print((2*m/3-2+22/m/3-4/m/m+2**.5*(2-4/m+2/m/m))*R) # Made By Mostafa_Khaled ```
output
1
17,996
3
35,993
Provide tags and a correct Python 3 solution for this coding contest problem. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0), respectively. Circles with numbers from m + ...
instruction
0
17,997
3
35,994
Tags: math Correct Solution: ``` import math m,R=map(int,input().split()) cord=math.sqrt(2*(R**2)) ans=0 unit=int(2*R) x=(m)*(m/2) for i in range(m): ans+=2*R*m ans+=(cord*(m-1)) if(i==0 or i==m-1): if(m==1): continue ans+=cord*(m-2) else: if(m==1): conti...
output
1
17,997
3
35,995
Provide tags and a correct Python 3 solution for this coding contest problem. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0), respectively. Circles with numbers from m + ...
instruction
0
17,998
3
35,996
Tags: math Correct Solution: ``` import math m,R = map (int,input().split()) D = math.sqrt (2) * R result = 0 def sum_dist (n): return n*(n+1)*R + 2*D*n for i in range (1,m+1): result += 2*R if i-1 > 0: result += 2*R + D if m-i > 0: result += 2*R + D if i-2 > 0: result += sum_dist (i-2) if m-i-1 >...
output
1
17,998
3
35,997
Provide tags and a correct Python 3 solution for this coding contest problem. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0), respectively. Circles with numbers from m + ...
instruction
0
17,999
3
35,998
Tags: math Correct Solution: ``` m, r = map(int, input().split()) def calc(k): if k < 1: return 0 else: return (1 + 2 * (k - 1)) * 2**0.5 + k * 2 + (k - 1) * (k - 2) avg = 0 div = m ** 2 for i in range(0, m): avg += r * (2 + calc(i) + calc(m - 1 - i)) / div print(avg) ```
output
1
17,999
3
35,999
Provide tags and a correct Python 3 solution for this coding contest problem. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0), respectively. Circles with numbers from m + ...
instruction
0
18,000
3
36,000
Tags: math Correct Solution: ``` m, r = map(int, input().split()) res, sq2 = 0, (2**.5) for i in range(1, m): res += 2 + sq2 + 2 * sq2 * (i-1) + (i-1) * i res = (res + m) * 2 * r print(res / (m * m)) ```
output
1
18,000
3
36,001
Provide tags and a correct Python 3 solution for this coding contest problem. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0), respectively. Circles with numbers from m + ...
instruction
0
18,001
3
36,002
Tags: math Correct Solution: ``` m,R=map(int, input().split()) print((2*m/3-2+22/m/3-4/m/m+2**.5*(2-4/m+2/m/m))*R) ```
output
1
18,001
3
36,003
Provide tags and a correct Python 3 solution for this coding contest problem. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0), respectively. Circles with numbers from m + ...
instruction
0
18,002
3
36,004
Tags: math Correct Solution: ``` m, r = map(int, input().split()) print(2 * r * (m + (2 + 2 ** 0.5) * (m - 1) + (m - 1) * (m - 2) * (m / 3 + 2 ** 0.5)) / (m * m)) ```
output
1
18,002
3
36,005
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0...
instruction
0
18,003
3
36,006
Yes
output
1
18,003
3
36,007
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0...
instruction
0
18,004
3
36,008
Yes
output
1
18,004
3
36,009
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0...
instruction
0
18,005
3
36,010
Yes
output
1
18,005
3
36,011
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0...
instruction
0
18,006
3
36,012
Yes
output
1
18,006
3
36,013
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0...
instruction
0
18,007
3
36,014
No
output
1
18,007
3
36,015
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0...
instruction
0
18,008
3
36,016
No
output
1
18,008
3
36,017
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0...
instruction
0
18,009
3
36,018
No
output
1
18,009
3
36,019
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0...
instruction
0
18,010
3
36,020
No
output
1
18,010
3
36,021
Provide a correct Python 3 solution for this coding contest problem. One particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know why their movements are so sluggish, the problem of laggy thinking has been recently resolved. It turns out that the reason is not (...
instruction
0
18,155
3
36,310
"Correct Solution: ``` from sys import stdin as fin # fin = open("hcc2016c1.in", "r") def dfs(v, p): global g, used, cnt cnt += 1 used[v] = True for u in g[v]: if u != p and (used[u] or not dfs(u, v)): return False return True n, m = map(int, fin.readline().split()) used = [Fal...
output
1
18,155
3
36,311
Provide a correct Python 3 solution for this coding contest problem. One particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know why their movements are so sluggish, the problem of laggy thinking has been recently resolved. It turns out that the reason is not (...
instruction
0
18,156
3
36,312
"Correct Solution: ``` # Python program to check if a given directed graph is strongly # connected or not import sys from collections import defaultdict class Graph: def __init__(self, V): self.V = V self.graph = defaultdict(list) def addEdge(self, v, w): # Add w to v ist. sel...
output
1
18,156
3
36,313
Provide a correct Python 3 solution for this coding contest problem. One particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know why their movements are so sluggish, the problem of laggy thinking has been recently resolved. It turns out that the reason is not (...
instruction
0
18,157
3
36,314
"Correct Solution: ``` def is_valid(): 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) if N-1 != M: return False ...
output
1
18,157
3
36,315
Provide a correct Python 3 solution for this coding contest problem. One particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know why their movements are so sluggish, the problem of laggy thinking has been recently resolved. It turns out that the reason is not (...
instruction
0
18,158
3
36,316
"Correct Solution: ``` l = [] were = [] def dfs(v): global l, were if not were: were = len(l) * [False] were[v] = True for i in l[v]: if not were[i]: dfs(i) n, m = map(int, input().split()) if m != n - 1: print("no") else: l = [[] for i in range(n)] for i in r...
output
1
18,158
3
36,317
Provide a correct Python 3 solution for this coding contest problem. One particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know why their movements are so sluggish, the problem of laggy thinking has been recently resolved. It turns out that the reason is not (...
instruction
0
18,159
3
36,318
"Correct Solution: ``` import sys sys.setrecursionlimit(1000000) def dfs(v, pr): global used global p global f if not f: return None if used[v]: f = False used[v] = True for i in range(len(p[v])): if p[v][i] != pr: dfs(p[v][i], v) n, m = map(int, input().s...
output
1
18,159
3
36,319