message
stringlengths
2
48.6k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
318
108k
cluster
float64
8
8
__index_level_0__
int64
636
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a random day, Neko found n treasure chests and m keys. The i-th chest has an integer a_i written on it and the j-th key has an integer b_j on it. Neko knows those chests contain the powerful ...
instruction
0
62,351
8
124,702
No
output
1
62,351
8
124,703
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a random day, Neko found n treasure chests and m keys. The i-th chest has an integer a_i written on it and the j-th key has an integer b_j on it. Neko knows those chests contain the powerful ...
instruction
0
62,352
8
124,704
No
output
1
62,352
8
124,705
Provide tags and a correct Python 3 solution for this coding contest problem. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals such that every 0 in the row is in exactly 1 int...
instruction
0
63,301
8
126,602
Tags: dp, greedy, two pointers Correct Solution: ``` import sys def Myfun(): n, m = map(int, fun2().split()) lines = [] rows = [[0]*(m+2) for i in range(n)] col = [n]*(m+2) lstart = [[] for i in range(m+2)] lend = [[] for i in range(m+2)] dp = [[0]*(m+2) for i in range(m+2)] for i in range(n): for j in range...
output
1
63,301
8
126,603
Provide tags and a correct Python 3 solution for this coding contest problem. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals such that every 0 in the row is in exactly 1 int...
instruction
0
63,302
8
126,604
Tags: dp, greedy, two pointers Correct Solution: ``` from sys import stdin, stdout if __name__ == '__main__': def omkar_and_last_floor(a, n, m): dp = [[0 for c in range(m)] for r in range(m)] #print(dp) for r in range(m): for l in range(r,-1,-1): for k in ran...
output
1
63,302
8
126,605
Provide tags and a correct Python 3 solution for this coding contest problem. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals such that every 0 in the row is in exactly 1 int...
instruction
0
63,303
8
126,606
Tags: dp, greedy, two pointers Correct Solution: ``` from bisect import * import sys int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(...
output
1
63,303
8
126,607
Provide tags and a correct Python 3 solution for this coding contest problem. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals such that every 0 in the row is in exactly 1 int...
instruction
0
63,304
8
126,608
Tags: dp, greedy, two pointers Correct Solution: ``` import sys input = sys.stdin.readline n, m = map(int, input().split()) s = [[[0 for _ in range(m)] for _ in range(m)] for _ in range(m)] for i in range(n): k = int(input()) for j in range(k): l, r = map(int, input().split()) l -= 1 ...
output
1
63,304
8
126,609
Provide tags and a correct Python 3 solution for this coding contest problem. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals such that every 0 in the row is in exactly 1 int...
instruction
0
63,305
8
126,610
Tags: dp, greedy, two pointers Correct Solution: ``` from bisect import * import sys int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(...
output
1
63,305
8
126,611
Provide tags and a correct Python 3 solution for this coding contest problem. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals such that every 0 in the row is in exactly 1 int...
instruction
0
63,306
8
126,612
Tags: dp, greedy, two pointers Correct Solution: ``` from bisect import * from collections import * from math import gcd,ceil,sqrt,floor,inf from heapq import * from itertools import * from operator import add,mul,sub,xor,truediv,floordiv from functools import * #------------------------------------------------------...
output
1
63,306
8
126,613
Provide tags and a correct Python 3 solution for this coding contest problem. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals such that every 0 in the row is in exactly 1 int...
instruction
0
63,307
8
126,614
Tags: dp, greedy, two pointers Correct Solution: ``` import sys def minp(): return sys.stdin.readline().strip() def mint(): return int(minp()) def mints(): return map(int, minp().split()) def solve(): n, m = mints() lines = [] rows = [[0]*(m+2) for i in range(n)] col = [n]*(m+2) lstart = [[] for i in range(...
output
1
63,307
8
126,615
Provide tags and a correct Python 3 solution for this coding contest problem. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals such that every 0 in the row is in exactly 1 int...
instruction
0
63,308
8
126,616
Tags: dp, greedy, two pointers Correct Solution: ``` import sys def rs(): return sys.stdin.readline().rstrip() def ri(): return int(sys.stdin.readline()) def ria(): return list(map(int, sys.stdin.readline().split())) def ws(s): sys.stdout.write(s); sys.stdout.write('\n') def wi(n): sys.stdout.write(str(n)); sys.stdout....
output
1
63,308
8
126,617
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals s...
instruction
0
63,309
8
126,618
Yes
output
1
63,309
8
126,619
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals s...
instruction
0
63,310
8
126,620
No
output
1
63,310
8
126,621
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals s...
instruction
0
63,311
8
126,622
No
output
1
63,311
8
126,623
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals s...
instruction
0
63,312
8
126,624
No
output
1
63,312
8
126,625
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Omkar is building a house. He wants to decide how to make the floor plan for the last floor. Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals s...
instruction
0
63,313
8
126,626
No
output
1
63,313
8
126,627
Provide tags and a correct Python 3 solution for this coding contest problem. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 +...
instruction
0
63,509
8
127,018
Tags: implementation Correct Solution: ``` n = int(input()) h = 0 flr = 0 while True: h += 1 flr += (h * (h + 1)) / 2 if flr > n: break print(h - 1) ```
output
1
63,509
8
127,019
Provide tags and a correct Python 3 solution for this coding contest problem. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 +...
instruction
0
63,510
8
127,020
Tags: implementation Correct Solution: ``` n=int(input()) z=1 c=1 d=0 while n>=z: n=n-z c=c+1 z=z+c d=d+1 print(d) ```
output
1
63,510
8
127,021
Provide tags and a correct Python 3 solution for this coding contest problem. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 +...
instruction
0
63,511
8
127,022
Tags: implementation Correct Solution: ``` t=int(input()) n=1 c=0 while(True): t=t-(n*(n+1)/2) n=n+1 c=c+1 if(t<(n)*(n+1)/2): break print(c) ```
output
1
63,511
8
127,023
Provide tags and a correct Python 3 solution for this coding contest problem. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 +...
instruction
0
63,512
8
127,024
Tags: implementation Correct Solution: ``` n=int(input()) s=0 i=1 k=0 a=[] while s<n: s=s+i a.append(s) i=i+1 b=[] s=0 for k in a: s=s+k b.append(s) k=0 for i in b: if i<=n: k=k+1 if n==1: print(1) else: print(k) ```
output
1
63,512
8
127,025
Provide tags and a correct Python 3 solution for this coding contest problem. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 +...
instruction
0
63,513
8
127,026
Tags: implementation Correct Solution: ``` n = int(input()) sum = 0 k = 0 while (sum + (k + 1) * (k + 2) // 2 <= n): k += 1 sum += k * (k + 1) // 2 print(k) ```
output
1
63,513
8
127,027
Provide tags and a correct Python 3 solution for this coding contest problem. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 +...
instruction
0
63,514
8
127,028
Tags: implementation Correct Solution: ``` def main(): num = int(input()) pyramid = [] pyramid.append(1) levelBlocks = 1 totalBlocks = 1 levels = 1 curr = 2 while True: if num <= totalBlocks: break levelBlocks += curr totalBlocks += levelBlocks curr += 1 levels+= 1 if num < totalBlocks: level...
output
1
63,514
8
127,029
Provide tags and a correct Python 3 solution for this coding contest problem. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 +...
instruction
0
63,515
8
127,030
Tags: implementation Correct Solution: ``` n = int(input()) i = 1 len = 1 sum = 1 while (n >= sum): i += 1 len += i sum += len print(i-1) ```
output
1
63,515
8
127,031
Provide tags and a correct Python 3 solution for this coding contest problem. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 +...
instruction
0
63,516
8
127,032
Tags: implementation Correct Solution: ``` k = int(input()) f = lambda x : x*(x+1)//2 x = 1 while k-f(x)>=0: k-=f(x) x+=1 print(x-1) ```
output
1
63,516
8
127,033
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 +...
instruction
0
63,517
8
127,034
Yes
output
1
63,517
8
127,035
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 +...
instruction
0
63,518
8
127,036
Yes
output
1
63,518
8
127,037
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 +...
instruction
0
63,519
8
127,038
Yes
output
1
63,519
8
127,039
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 +...
instruction
0
63,520
8
127,040
Yes
output
1
63,520
8
127,041
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 +...
instruction
0
63,521
8
127,042
No
output
1
63,521
8
127,043
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 +...
instruction
0
63,522
8
127,044
No
output
1
63,522
8
127,045
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 +...
instruction
0
63,523
8
127,046
No
output
1
63,523
8
127,047
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 +...
instruction
0
63,524
8
127,048
No
output
1
63,524
8
127,049
Provide a correct Python 3 solution for this coding contest problem. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of JOI's house. These icicles are aligned and i cm (1 ≤ i ≤...
instruction
0
63,927
8
127,854
"Correct Solution: ``` def loadIcicle(): icicles = [] line = input().strip().split(" ") N, L = int(line[0]), int(line[1]) while True: icicles.append(int(input().strip())) if len(icicles) == N: break return icicles, N, L def calcDiff(icicles, N): diff_2times = [0]*N for idx in range(N): dif_right = icicle...
output
1
63,927
8
127,855
Provide a correct Python 3 solution for this coding contest problem. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of JOI's house. These icicles are aligned and i cm (1 ≤ i ≤...
instruction
0
63,928
8
127,856
"Correct Solution: ``` def solve(): n, l = map(int,input().split()) ans = 0 pre = 0 trend = 1 acc = 0 for i in range(n): length = int(input()) time = l - length if length > pre and trend >= 0: acc += time elif length < pre and trend <= 0: acc += time else: if ans < acc:...
output
1
63,928
8
127,857
Provide a correct Python 3 solution for this coding contest problem. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of JOI's house. These icicles are aligned and i cm (1 ≤ i ≤...
instruction
0
63,929
8
127,858
"Correct Solution: ``` def loadIcicle(): icicles = [] line = input().strip().split(" ") N, L = int(line[0]), int(line[1]) while True: icicles.append(int(input().strip())) if len(icicles) == N: break return icicles, N, L icicles, N, L = loadIcicle() def calcDiff(icicles, N): diff_2times = [0]*N for idx in r...
output
1
63,929
8
127,859
Provide a correct Python 3 solution for this coding contest problem. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of JOI's house. These icicles are aligned and i cm (1 ≤ i ≤...
instruction
0
63,930
8
127,860
"Correct Solution: ``` n,l = map(int,input().split()) length = [int(input()) for i in range(n)] pare = [(length[i], i) for i in range(n)] pare.sort(reverse=True) ind = [p[1] for p in pare] dp = [0] * (n + 1) for i in ind: if i == 0: dp[i] = dp[i + 1] + (l - length[i]) else: dp[i] = max(dp[i - 1], dp[i + 1]...
output
1
63,930
8
127,861
Provide a correct Python 3 solution for this coding contest problem. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of JOI's house. These icicles are aligned and i cm (1 ≤ i ≤...
instruction
0
63,931
8
127,862
"Correct Solution: ``` def solve(): n,l = map(int,input().split()) length = [int(input()) for i in range(n)] pare = [(length[i], i) for i in range(n)] pare.sort(reverse=True) dp = [0] * (n + 1) for p in pare: i = p[1] if i == 0: dp[i] = dp[i + 1] + (l - length[i]) else: dp[i] = ma...
output
1
63,931
8
127,863
Provide a correct Python 3 solution for this coding contest problem. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of JOI's house. These icicles are aligned and i cm (1 ≤ i ≤...
instruction
0
63,932
8
127,864
"Correct Solution: ``` def orderN(N,L,ices): upPeak = L - ices[0] downPeak = L - ices[0] peaks = [] for i in range(len(ices)): if i < N-1: if ices[i] < ices[i+1]: peaks.append(downPeak) downPeak = L - ices[i+1] upPeak += L - ices[i+1] ...
output
1
63,932
8
127,865
Provide a correct Python 3 solution for this coding contest problem. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of JOI's house. These icicles are aligned and i cm (1 ≤ i ≤...
instruction
0
63,933
8
127,866
"Correct Solution: ``` def loadIcicle(): icicles = [] line = input().strip().split(" ") N, L = int(line[0]), int(line[1]) while True: icicles.append(int(input().strip())) if len(icicles) == N: break return icicles, N, L icicles, N, L = loadIcicle() def calcDiff(icicles, N): diff_2times = [0]*N for idx in r...
output
1
63,933
8
127,867
Provide a correct Python 3 solution for this coding contest problem. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of JOI's house. These icicles are aligned and i cm (1 ≤ i ≤...
instruction
0
63,934
8
127,868
"Correct Solution: ``` def solve(): n, l = map(int,input().split()) ans = 0 pre = 0 prepre = 0 acc = 0 for i in range(n): length = int(input()) time = l - length if length > pre and pre >= prepre: acc += time elif length < pre and pre <= prepre: acc += time else: if ans...
output
1
63,934
8
127,869
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of ...
instruction
0
63,935
8
127,870
Yes
output
1
63,935
8
127,871
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of ...
instruction
0
63,936
8
127,872
Yes
output
1
63,936
8
127,873
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of ...
instruction
0
63,937
8
127,874
Yes
output
1
63,937
8
127,875
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of ...
instruction
0
63,938
8
127,876
Yes
output
1
63,938
8
127,877
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of ...
instruction
0
63,939
8
127,878
No
output
1
63,939
8
127,879
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of ...
instruction
0
63,940
8
127,880
No
output
1
63,940
8
127,881
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of ...
instruction
0
63,941
8
127,882
No
output
1
63,941
8
127,883
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles. There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of ...
instruction
0
63,942
8
127,884
No
output
1
63,942
8
127,885
Provide tags and a correct Python 3 solution for this coding contest problem. Furik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of n parts and to complete each part a player may probably need to complete some other ones. We know that the g...
instruction
0
64,269
8
128,538
Tags: dfs and similar, greedy Correct Solution: ``` from collections import * read_line = lambda: [int(i) for i in input().split(' ')] n = read_line()[0] cs = [c - 1 for c in read_line()] g = [[] for v in range(n)] parent_cnt = [0] * n for v in range(n): parents = read_line() parent_cnt[v] = len(parents) - 1 ...
output
1
64,269
8
128,539
Provide tags and a correct Python 3 solution for this coding contest problem. Furik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of n parts and to complete each part a player may probably need to complete some other ones. We know that the g...
instruction
0
64,270
8
128,540
Tags: dfs and similar, greedy Correct Solution: ``` from collections import * read_line = lambda: [int(i) for i in input().split(' ')] n = read_line()[0] cs = [c - 1 for c in read_line()] g = [[] for v in range(n)] parent_cnt = [0] * n for v in range(n): parents = read_line() parent_cnt[v] = len(parents) - 1 ...
output
1
64,270
8
128,541
Provide tags and a correct Python 3 solution for this coding contest problem. Furik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of n parts and to complete each part a player may probably need to complete some other ones. We know that the g...
instruction
0
64,271
8
128,542
Tags: dfs and similar, greedy Correct Solution: ``` n = int(input()) h = [int(q) - 1 for q in input().split()] u = [set([int(q) - 1 for q in input().split()][1:]) for i in range(n)] t = 1e9 def g(): for i in p: if h[i] == k and not v[i]: return i for k in range(3): p = list(range(n)) ...
output
1
64,271
8
128,543