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 |
|---|---|---|---|---|---|
Provide a correct Python 3 solution for this coding contest problem.
Mr. Kobou found a bundle of old paper when he was cleaning his family home. On each paper, two series of numbers are written. Strange as it appeared to him, Mr. Kobou further went through the storehouse and found out a note his ancestor left. Accordi... | instruction | 0 | 87,447 | 8 | 174,894 |
"Correct Solution:
```
input()
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
ans = 0
A.sort(reverse=True)
for a in A:
B.sort(reverse=True)
for i in range(a):
B[i] -= 1
if min(B) < 0:
ans = 0
break
if max(B) == 0:
ans = 1
print(ans)
``` | output | 1 | 87,447 | 8 | 174,895 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.
Let:
... | instruction | 0 | 87,669 | 8 | 175,338 |
Tags: dp, shortest paths
Correct Solution:
```
# BHUPAT JANGID (codechef id : bhupat2000) (codeforces id : bhupat2000)
# linkedin id : https://www.linkedin.com/in/bhupat-jangid-1b7b53170
import sys
from heapq import heapify, heappop, heappush
from itertools import *
from collections import *
from math import *
#impo... | output | 1 | 87,669 | 8 | 175,339 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.
Let:
... | instruction | 0 | 87,670 | 8 | 175,340 |
Tags: dp, shortest paths
Correct Solution:
```
n,c=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
dp=[[0]*2for i in range(n+1)]
print(0,end=" ")
for i in range(n-1):
if i>0:
dp[i][0]=min(dp[i-1][0]+y[i],dp[i-1][1]+y[i]+c)
dp[i][1]=min(dp[i-1][0],dp[i-1][1]... | output | 1 | 87,670 | 8 | 175,341 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.
Let:
... | instruction | 0 | 87,671 | 8 | 175,342 |
Tags: dp, shortest paths
Correct Solution:
```
#hint: https://codeforces.com/blog/entry/70779
inp = lambda : map(int, input().split())
n, c = inp()
a = list(inp())
b = list(inp())
ans = list()
ans.append(0)
arr = [[1000000000,10000000000] for i in range(n)]
arr[0][0] = 0
arr[0][1] = c
for i in range(n-1):
arr[... | output | 1 | 87,671 | 8 | 175,343 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.
Let:
... | instruction | 0 | 87,672 | 8 | 175,344 |
Tags: dp, shortest paths
Correct Solution:
```
n,c=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp=[[0,c] for i in range(n)]
for i in range(1,n):
dp[i][0]=min(dp[i-1][0],dp[i-1][1])+a[i-1]
dp[i][1]=min(dp[i-1][0]+c+b[i-1],dp[i-1][1]+b[i-1])
ans=[]
for i in range(n):
ans.... | output | 1 | 87,672 | 8 | 175,345 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.
Let:
... | instruction | 0 | 87,673 | 8 | 175,346 |
Tags: dp, shortest paths
Correct Solution:
```
"""
NTC here
"""
from sys import stdin, setrecursionlimit
setrecursionlimit(10**7)
def iin(): return int(stdin.readline())
def lin(): return list(map(int, stdin.readline().split()))
# range = xrange
# input = raw_input
def main():
n,c=lin()
s=lin()
e=... | output | 1 | 87,673 | 8 | 175,347 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.
Let:
... | instruction | 0 | 87,674 | 8 | 175,348 |
Tags: dp, shortest paths
Correct Solution:
```
import sys
input = lambda :sys.stdin.readline().rstrip('\r\n')
from math import log,ceil
from collections import defaultdict
n,c = map(int,input().split())
# 0 for currently in stairs
# 1 for in the elevator
dp = [[float('inf'),float('inf')] for _ in range(n)]
dp[0][0] = 0... | output | 1 | 87,674 | 8 | 175,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.
Let:
... | instruction | 0 | 87,675 | 8 | 175,350 |
Tags: dp, shortest paths
Correct Solution:
```
n,c=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=[0]
INF=1e18
dp=[[INF,INF] for _ in range(n)]
dp[1][0]=a[0]
dp[1][1]=b[0]+c
ans.append(min(dp[1]))
for i in range(1,n-1):
temp=0
dp[i+1][0]=min(dp[i+1][0],dp[i]... | output | 1 | 87,675 | 8 | 175,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.
Let:
... | instruction | 0 | 87,676 | 8 | 175,352 |
Tags: dp, shortest paths
Correct Solution:
```
R = lambda:list(map(int,input().split()))
n, c = R()
stair = R()
elevator = R()
ans, dp_of_stair, dp_of_elevator = [], [0], [c]
for i in range(n-1):
dp_of_stair.append(min(dp_of_stair[-1] + stair[i], dp_of_elevator[-1]+ stair[i]))
dp_of_elevator.append(min(dp_of_st... | output | 1 | 87,676 | 8 | 175,353 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to rea... | instruction | 0 | 87,677 | 8 | 175,354 |
Yes | output | 1 | 87,677 | 8 | 175,355 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to rea... | instruction | 0 | 87,678 | 8 | 175,356 |
Yes | output | 1 | 87,678 | 8 | 175,357 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to rea... | instruction | 0 | 87,679 | 8 | 175,358 |
Yes | output | 1 | 87,679 | 8 | 175,359 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to rea... | instruction | 0 | 87,680 | 8 | 175,360 |
Yes | output | 1 | 87,680 | 8 | 175,361 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to rea... | instruction | 0 | 87,681 | 8 | 175,362 |
No | output | 1 | 87,681 | 8 | 175,363 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to rea... | instruction | 0 | 87,682 | 8 | 175,364 |
No | output | 1 | 87,682 | 8 | 175,365 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to rea... | instruction | 0 | 87,683 | 8 | 175,366 |
No | output | 1 | 87,683 | 8 | 175,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to rea... | instruction | 0 | 87,684 | 8 | 175,368 |
No | output | 1 | 87,684 | 8 | 175,369 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to play with cubes. During the game he takes a cube... | instruction | 0 | 87,899 | 8 | 175,798 |
Tags: combinatorics, constructive algorithms, greedy, implementation, math, sortings
Correct Solution:
```
from sys import stdin
n = int(stdin.readline())
a = [int(x) for x in stdin.readline().split()]
a = sorted([(a[x], x) for x in range(n*2)])
group = {}
for x,ind in a:
if x in group:
group[x].append(i... | output | 1 | 87,899 | 8 | 175,799 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to play with cubes. During the game he takes a cube... | instruction | 0 | 87,900 | 8 | 175,800 |
Tags: combinatorics, constructive algorithms, greedy, implementation, math, sortings
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
R = range(100)
c = [[] for _ in [0]*100]
for i in range(n*2):
c[a[i]].append(i)
d = [0]*200
heap = 1
z = [0, 0, 0]
for i in R:
if len(c[i]) == 1:
z[heap]+=1... | output | 1 | 87,900 | 8 | 175,801 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to play with cubes. During the game he takes a cube... | instruction | 0 | 87,901 | 8 | 175,802 |
Tags: combinatorics, constructive algorithms, greedy, implementation, math, sortings
Correct Solution:
```
from collections import defaultdict as defdict
n = int(input())
d = defdict(int)
a = list(map(int, input().split()))
for i in a:
d[i] += 1
b = set(i for i in a if d[i] > 1)
c = [i for i in a if d[i] == 1]
... | output | 1 | 87,901 | 8 | 175,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to play with cubes. During the game he takes a cube... | instruction | 0 | 87,902 | 8 | 175,804 |
Tags: combinatorics, constructive algorithms, greedy, implementation, math, sortings
Correct Solution:
```
n=int(input())
arr=list(map(int,input().split()))
g=[[] for i in range(100)]
for i in range(2*n):
g[arr[i]].append(i)
x=0
y=0
curr=1
r=[]
for i in range(10,100):
if len(g[i])==1:
arr[g[i][0]]=curr
... | output | 1 | 87,902 | 8 | 175,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to play with cubes. During the game he takes a cube... | instruction | 0 | 87,903 | 8 | 175,806 |
Tags: combinatorics, constructive algorithms, greedy, implementation, math, sortings
Correct Solution:
```
from math import*
from random import*
n = int(input()) * 2
A = list(map(int, input().split()))
amount = [0] * 101
B = []
for i in range(n):
if amount[A[i]] < 2:
amount[A[i]] += 1
B += [(A[i],... | output | 1 | 87,903 | 8 | 175,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to play with cubes. During the game he takes a cube... | instruction | 0 | 87,904 | 8 | 175,808 |
Tags: combinatorics, constructive algorithms, greedy, implementation, math, sortings
Correct Solution:
```
#!/usr/bin/env python3
n = int(input())
a = list(map(int,input().split()))
c = [0] * 100
for i in a:
c[i] += 1
x = [0] * 100
y = [0] * 100
j = 0
for i in range(100):
if c[i] == 1:
[x, y][j][i] += 1... | output | 1 | 87,904 | 8 | 175,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to play with cubes. During the game he takes a cube... | instruction | 0 | 87,905 | 8 | 175,810 |
Tags: combinatorics, constructive algorithms, greedy, implementation, math, sortings
Correct Solution:
```
from collections import *
n = int(input())
a = list(map(int,input().split()))
c = Counter(a)
for i in range(2*n):
a[i] = [a[i],i]
a.sort()
ans = [0 for i in range(2*n)]
da, db = {}, {}
f = 0
for i in range(2*n):
... | output | 1 | 87,905 | 8 | 175,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to play with cubes. During the game he takes a cube... | instruction | 0 | 87,906 | 8 | 175,812 |
Tags: combinatorics, constructive algorithms, greedy, implementation, math, sortings
Correct Solution:
```
n, t = 2 * int(input()), map(int, input().split())
d = [[] for i in range(100)]
for i, j in enumerate(t):
d[j].append(i)
y, x = [], False
p, q = [], ['1'] * n
for i in d[10: 100]:
if i:
if len(i) =... | output | 1 | 87,906 | 8 | 175,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to p... | instruction | 0 | 87,907 | 8 | 175,814 |
Yes | output | 1 | 87,907 | 8 | 175,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to p... | instruction | 0 | 87,908 | 8 | 175,816 |
Yes | output | 1 | 87,908 | 8 | 175,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to p... | instruction | 0 | 87,909 | 8 | 175,818 |
Yes | output | 1 | 87,909 | 8 | 175,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to p... | instruction | 0 | 87,910 | 8 | 175,820 |
Yes | output | 1 | 87,910 | 8 | 175,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to p... | instruction | 0 | 87,911 | 8 | 175,822 |
No | output | 1 | 87,911 | 8 | 175,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to p... | instruction | 0 | 87,912 | 8 | 175,824 |
No | output | 1 | 87,912 | 8 | 175,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to p... | instruction | 0 | 87,913 | 8 | 175,826 |
No | output | 1 | 87,913 | 8 | 175,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to p... | instruction | 0 | 87,914 | 8 | 175,828 |
No | output | 1 | 87,914 | 8 | 175,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai β€ bi).
Jafar has decided to pour all remaining cola into just 2 cans, det... | instruction | 0 | 88,075 | 8 | 176,150 |
Yes | output | 1 | 88,075 | 8 | 176,151 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai β€ bi).
Jafar has decided to pour all remaining cola into just 2 cans, det... | instruction | 0 | 88,077 | 8 | 176,154 |
Yes | output | 1 | 88,077 | 8 | 176,155 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai β€ bi).
Jafar has decided to pour all remaining cola into just 2 cans, det... | instruction | 0 | 88,078 | 8 | 176,156 |
Yes | output | 1 | 88,078 | 8 | 176,157 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai β€ bi).
Jafar has decided to pour all remaining cola into just 2 cans, det... | instruction | 0 | 88,081 | 8 | 176,162 |
No | output | 1 | 88,081 | 8 | 176,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hopefully) years.
The d... | instruction | 0 | 88,356 | 8 | 176,712 |
Tags: dfs and similar, graphs
Correct Solution:
```
# 1027D
import collections
def do():
n = int(input())
costs = [int(c) for c in input().split(" ")]
next = [int(c)-1 for c in input().split(" ")]
ind = [0] * n
for i,c in enumerate(next):
if i != c:
ind[c] += 1
seen = [0] * n... | output | 1 | 88,356 | 8 | 176,713 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hopefully) years.
The d... | instruction | 0 | 88,357 | 8 | 176,714 |
Tags: dfs and similar, graphs
Correct Solution:
```
import sys
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n = int(input())
C = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [a-1 for a in A]
visit = [False]*n
loops = []
for i in range(n):
if not visit[i]:
... | output | 1 | 88,357 | 8 | 176,715 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hopefully) years.
The d... | instruction | 0 | 88,358 | 8 | 176,716 |
Tags: dfs and similar, graphs
Correct Solution:
```
def count(n,c,a):
vis=[0]*(n+1)
z=[]
p=[]
for i in range(1,n+1):
x=i
while vis[x]==0:
vis[x]=i
x=a[x-1]
if vis[x]==i:
... | output | 1 | 88,358 | 8 | 176,717 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hopefully) years.
The d... | instruction | 0 | 88,359 | 8 | 176,718 |
Tags: dfs and similar, graphs
Correct Solution:
```
n=int(input())
c=list(map(int,input().split()))
a=list(map(int,input().split()))
ans=0
v=[False for i in range(n)]
for i in range(n):
if v[i]:continue
p=set()
pl=[]
s=set([i])
t=True
while s and t:
x=s.pop()
v[x]=True
p.add(x)
pl.append(x)
nex=a[x]-1
... | output | 1 | 88,359 | 8 | 176,719 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hopefully) years.
The d... | instruction | 0 | 88,360 | 8 | 176,720 |
Tags: dfs and similar, graphs
Correct Solution:
```
#yeh dil maange more
n = int(input())
c = [0]+(list(map(int,input().split())))
a = [0]+(list(map(int,input().split())))
vis = [0] * (n+1)
ans = 0
for i in range(1,n+1):
x = i
while vis[x] == 0:
vis[x] = i
x = a[x]
if vis[x] != i:
... | output | 1 | 88,360 | 8 | 176,721 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hopefully) years.
The d... | instruction | 0 | 88,361 | 8 | 176,722 |
Tags: dfs and similar, graphs
Correct Solution:
```
n = int(input())
cost = [0] + [int(item) for item in input().split()]
route = [0] + [int(r) for r in input().split()]
visited = [0] + [False for i in range(n)]
ans = 0
for i in range(1,n+1):
if visited[i] == True:
continue
circle = []
node = i... | output | 1 | 88,361 | 8 | 176,723 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hopefully) years.
The d... | instruction | 0 | 88,362 | 8 | 176,724 |
Tags: dfs and similar, graphs
Correct Solution:
```
import sys
rd = lambda : sys.stdin.readline().rstrip()
n = int(rd())
c = list(map(int, rd().split()))
a = list(map(lambda x: int(x)-1, rd().split()))
visited = [-1] * (n)
res = 0
for i in range(n):
trace = []
t = i
mn = 1e9
while visited[t] ==... | output | 1 | 88,362 | 8 | 176,725 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hopefully) years.
The d... | instruction | 0 | 88,363 | 8 | 176,726 |
Tags: dfs and similar, graphs
Correct Solution:
```
def kormin(kezd,K,a,c):
i=kezd
hal=[kezd]
K[kezd]=1
elert=1
while(K[a[i]]==0 and korben[a[i]]==0):
K[a[i]]=1
hal.append(a[i])
elert=elert+1
i=a[i]
minkor=0
if(korben[a[i]]==0 and a[i] in hal):
vege=i
... | output | 1 | 88,363 | 8 | 176,727 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dor... | instruction | 0 | 88,364 | 8 | 176,728 |
Yes | output | 1 | 88,364 | 8 | 176,729 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dor... | instruction | 0 | 88,365 | 8 | 176,730 |
Yes | output | 1 | 88,365 | 8 | 176,731 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dor... | instruction | 0 | 88,366 | 8 | 176,732 |
Yes | output | 1 | 88,366 | 8 | 176,733 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dor... | instruction | 0 | 88,367 | 8 | 176,734 |
Yes | output | 1 | 88,367 | 8 | 176,735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dor... | instruction | 0 | 88,368 | 8 | 176,736 |
No | output | 1 | 88,368 | 8 | 176,737 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.