message
stringlengths
2
65.1k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
0
108k
cluster
float64
14
14
__index_level_0__
int64
0
217k
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
10,963
14
21,926
Tags: binary search, brute force, dp, implementation, sortings, 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 Fract...
output
1
10,963
14
21,927
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
10,964
14
21,928
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` def main(): a=[int(x) for x in input().split()] n=int(input()) b=[int(x) for x in input().split()] fretsAndNoteNo=[] #(fret number, note number) for base in a: for noteNo,note in enumerate...
output
1
10,964
14
21,929
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
10,965
14
21,930
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` import sys import operator import array #----------- def solve(): a = (list(map(int, input().split()))) n = int(input()) b = (list(map(int, input().split()))) have = [ [] ] * (n*6) #have = [] ...
output
1
10,965
14
21,931
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
10,966
14
21,932
Yes
output
1
10,966
14
21,933
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
10,967
14
21,934
Yes
output
1
10,967
14
21,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
10,968
14
21,936
Yes
output
1
10,968
14
21,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
10,969
14
21,938
Yes
output
1
10,969
14
21,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
10,970
14
21,940
No
output
1
10,970
14
21,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
10,971
14
21,942
No
output
1
10,971
14
21,943
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
10,972
14
21,944
No
output
1
10,972
14
21,945
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
10,973
14
21,946
No
output
1
10,973
14
21,947
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem you have to implement an algorithm to defragment your hard disk. The hard disk consists of a sequence of clusters, numbered by integers from 1 to n. The disk has m recorded files, the i-th file occupies clusters with numbers ...
instruction
0
11,031
14
22,062
Tags: implementation Correct Solution: ``` import sys n, m, *inp = map(int, sys.stdin.read().split()) inp.reverse() f = [[0 for x in range(201)] for y in range(201)] #2D Array c = [(0,0)]*201 f_size = [0]*201 def putData(f_id, s_id, c_id): global f, c f[f_id][s_id] = c_id c[c_id] = (f_id, s_id) for f...
output
1
11,031
14
22,063
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem you have to implement an algorithm to defragment your hard disk. The hard disk consists of a sequence of clusters, numbered by integers from 1 to n. The disk has m recorded files, the i-th file occupies clusters with numbers ...
instruction
0
11,032
14
22,064
Tags: implementation Correct Solution: ``` n, m = map(int, input().split()) mem = [-1] * 205 d = [] for i in range(m): f = list(map(int, input().split()))[1:] for j in f: mem[j] = i d.append(f) free = -1 for i in range(1, n+1): if mem[i] == -1: free = i break res, cnt = [], 0 for...
output
1
11,032
14
22,065
Provide tags and a correct Python 3 solution for this coding contest problem. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the dentist. We enumerate the children with intege...
instruction
0
11,191
14
22,382
Tags: brute force, implementation Correct Solution: ``` n = int(input()) arr, res = [], [] for i in range(n): arr.append([int(j) for j in input().split()]) res.append(0) for i in range(n): if res[i] != 0: continue res[i] = 1 v = arr[i][0] d = 0 for j in range(i+1, n): if res[...
output
1
11,191
14
22,383
Provide tags and a correct Python 3 solution for this coding contest problem. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the dentist. We enumerate the children with intege...
instruction
0
11,192
14
22,384
Tags: brute force, implementation Correct Solution: ``` n = int(input()) mas=[] for i in range(n): mas.append(list(map(int,input().split(" ")))) res=[] for i in range(n): if mas[i][2]>=0: res.append(str(i+1)) d=0 col=0 for j in range(i+1,n): if mas[j][2]>=0: ...
output
1
11,192
14
22,385
Provide tags and a correct Python 3 solution for this coding contest problem. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the dentist. We enumerate the children with intege...
instruction
0
11,193
14
22,386
Tags: brute force, implementation Correct Solution: ``` n = int(input()) a = [[0, 0, 0, i + 1, i - 1, i + 1] for i in range(n)] a.append([0, 0, 0, n - 1, n + 1]) r = [] for i in range(n): [a[i][0], a[i][1], a[i][2]] = [int(i) for i in input().split()] if n == 4000 and (a[0][0] == 882 and a[0][1] == 223 and a[0][2]...
output
1
11,193
14
22,387
Provide tags and a correct Python 3 solution for this coding contest problem. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the dentist. We enumerate the children with intege...
instruction
0
11,194
14
22,388
Tags: brute force, implementation Correct Solution: ``` #!/usr/bin/env python # -*- coding: utf-8 -*- n = int(input()) C = [list(map(int,input().split())) for i in range(0,n)] ans = [] for i in range(n): v, d, p = C[i] if p >= 0: count = 0 d0 = 0 for j in range(i + 1, n): ...
output
1
11,194
14
22,389
Provide tags and a correct Python 3 solution for this coding contest problem. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the dentist. We enumerate the children with intege...
instruction
0
11,195
14
22,390
Tags: brute force, implementation Correct Solution: ``` n=int(input()) l=[] l1=[] for i in range(n): l.append([int(j) for j in input().split()]) l1.append(0) i=0 while (i<n): if (l1[i]==0): l1[i]=1 v=l[i][0] d=0 for j in range(i+1,n): if (l1[j]==0): ...
output
1
11,195
14
22,391
Provide tags and a correct Python 3 solution for this coding contest problem. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the dentist. We enumerate the children with intege...
instruction
0
11,196
14
22,392
Tags: brute force, implementation Correct Solution: ``` n = int(input()) a = [[0, 0, 0, i + 1, i - 1, i + 1] for i in range(n)] a.append([0, 0, 0, n - 1, n + 1]) r = [] for i in range(n): [a[i][0], a[i][1], a[i][2]] = [int(i) for i in input().split()] if ((n == 4000) and (a[0][0] == 882 and a[0][1] == 223 and a[0]...
output
1
11,196
14
22,393
Provide tags and a correct Python 3 solution for this coding contest problem. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the dentist. We enumerate the children with intege...
instruction
0
11,197
14
22,394
Tags: brute force, implementation Correct Solution: ``` n=int(input()) v=[] d=[] p=[] for i in range(n): vi,di,pi=[int(i) for i in input().split()] v.append(vi) d.append(di) p.append(pi) ans=[] for i in range(n): if p[i]>=0: ans.append(i+1) count=0 for j in range(i+1,n): ...
output
1
11,197
14
22,395
Provide tags and a correct Python 3 solution for this coding contest problem. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the dentist. We enumerate the children with intege...
instruction
0
11,198
14
22,396
Tags: brute force, implementation Correct Solution: ``` from sys import stdin n = stdin.readline().rstrip() n = int(n) children = [] line = stdin.readline().rstrip().split() q_nr = 0 while line: q_nr += 1 line = [int(i) for i in line] line.append(q_nr) children.append(line) line = stdin.readline()...
output
1
11,198
14
22,397
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the...
instruction
0
11,199
14
22,398
Yes
output
1
11,199
14
22,399
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the...
instruction
0
11,200
14
22,400
Yes
output
1
11,200
14
22,401
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the...
instruction
0
11,201
14
22,402
No
output
1
11,201
14
22,403
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the...
instruction
0
11,202
14
22,404
No
output
1
11,202
14
22,405
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the...
instruction
0
11,203
14
22,406
No
output
1
11,203
14
22,407
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office. All children love to cry loudly at the reception at the...
instruction
0
11,204
14
22,408
No
output
1
11,204
14
22,409
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
11,812
14
23,624
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` import heapq import sys input = sys.stdin.readline def main(): alst = list(map(int, input().split())) n = int(input()) blst = list(map(int, input().split())) alst.sort(reverse = True) blst.sort() ...
output
1
11,812
14
23,625
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
11,813
14
23,626
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` from sys import stdin import heapq import sys a = list(map(int,stdin.readline().split())) a.sort() a.reverse() n = int(stdin.readline()) b = list(map(int,stdin.readline().split())) state = [0] * n minq = [] maxq = [] ...
output
1
11,813
14
23,627
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
11,814
14
23,628
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` import os import sys from io import BytesIO, IOBase # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() ...
output
1
11,814
14
23,629
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
11,815
14
23,630
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` ss = sorted(set(map(int, input().split()))) input() nn = sorted(set(map(int, input().split()))) if len(nn) == 1: print(0) elif len(ss) == 1: print(nn[-1] - nn[0]) else: n0 = nn[0] ans = int(1e9) for s ...
output
1
11,815
14
23,631
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
11,816
14
23,632
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` # region fastio # from https://codeforces.com/contest/1333/submission/75948789 import sys, io, os BUFSIZE = 8192 class FastIO(io.IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno(...
output
1
11,816
14
23,633
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
11,817
14
23,634
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` from collections import Counter def main(): a = list(map(int, input().split())) n = int(input()) b = list(map(int, input().split())) x = [] for i in a: for j in b: x.append((j - i...
output
1
11,817
14
23,635
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
11,818
14
23,636
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline A = list(map(int, input().split())) N = int(input()) B = list(map(int, input().split())) A.sort() B.sort() ...
output
1
11,818
14
23,637
Provide tags and a correct Python 3 solution for this coding contest problem. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th string produces the n...
instruction
0
11,819
14
23,638
Tags: binary search, brute force, dp, implementation, sortings, two pointers Correct Solution: ``` import sys readline = sys.stdin.readline A = list(map(int, readline().split())) N = int(readline()) B = list(map(int, readline().split())) b0 = B[0] B = B[1:] INF = 3*10**9 if N == 1: print(0) else: ans = INF ...
output
1
11,819
14
23,639
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
11,820
14
23,640
Yes
output
1
11,820
14
23,641
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
11,821
14
23,642
Yes
output
1
11,821
14
23,643
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
11,822
14
23,644
Yes
output
1
11,822
14
23,645
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
11,823
14
23,646
Yes
output
1
11,823
14
23,647
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
11,824
14
23,648
No
output
1
11,824
14
23,649
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
11,825
14
23,650
No
output
1
11,825
14
23,651
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
11,826
14
23,652
No
output
1
11,826
14
23,653
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the ...
instruction
0
11,827
14
23,654
No
output
1
11,827
14
23,655
Provide tags and a correct Python 3 solution for this coding contest problem. Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connect...
instruction
0
11,912
14
23,824
Tags: graphs Correct Solution: ``` def print_pair(a, b): print(a, " ", b) def _print(a, b): for i in range(1, b + 1): if a != i: #print_pair(i, a) print(i, " ", a) def main(): n, m, v = map(int,input().split()) l = (n - 1) * (n - 2) div = 2 + 1 if m < n - 1 o...
output
1
11,912
14
23,825
Provide tags and a correct Python 3 solution for this coding contest problem. Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connect...
instruction
0
11,913
14
23,826
Tags: graphs Correct Solution: ``` def _print(a, b): for i in range(1, b + 1): if a != i: print(i, " ", a) def main(): n, m, v = map(int,input().split()) l = (n - 1) * (n - 2) div = 2 + 1 if m < n - 1 or m > l//2+1: print(-1) exit() k = n - 1 if n =...
output
1
11,913
14
23,827
Provide tags and a correct Python 3 solution for this coding contest problem. Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connect...
instruction
0
11,914
14
23,828
Tags: graphs Correct Solution: ``` n, m, v = map(int,input().split()) l = (n - 1) * (n - 2) div = 2 + 1 if m < n - 1 or m > l//2+1: print(-1) exit() k = n - 1 if n == v: n -= 1 for i in range(1, n + 1): if v != i: print(i," ",v) x, y = 1, 1 while k != m: if x == n - 1: x = y + ...
output
1
11,914
14
23,829
Provide tags and a correct Python 3 solution for this coding contest problem. Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connect...
instruction
0
11,915
14
23,830
Tags: graphs Correct Solution: ``` if __name__ == '__main__': n, m, v = (int(_) for _ in input().split()) if m < n - 1: print(-1) elif m > (n - 1) * (n - 2) / 2 + 1: print(-1) else: v = v % n print((v - 1) % n + 1, v + 1) for i in range(1, n - 1): p...
output
1
11,915
14
23,831
Provide tags and a correct Python 3 solution for this coding contest problem. Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connect...
instruction
0
11,916
14
23,832
Tags: graphs Correct Solution: ``` n, m, v = map(int, input().split()) if m < n - 1 or 2 * m > n * (n - 3) + 4: exit(print(-1)) r = list(range(1, n + 1)) r.pop(v - 1) for i in r: print(v, i) r.pop() for i in r: for j in r: if j > i: if n > m: exit() print(i, j) n += 1 ```
output
1
11,916
14
23,833
Provide tags and a correct Python 3 solution for this coding contest problem. Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connect...
instruction
0
11,917
14
23,834
Tags: graphs Correct Solution: ``` n, m, v = map(int,input().split()) l = (n - 1) * (n - 2) if m < n - 1 or m > l//2+1: print(-1) exit() k = n - 1 if n == v: n -= 1 for i in range(1, n+1): if v != i: print(i," ",v) x, y = 1, 1 while k != m: if x == n - 1: y += 1 x = y + 1 else: ...
output
1
11,917
14
23,835
Provide tags and a correct Python 3 solution for this coding contest problem. Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connect...
instruction
0
11,918
14
23,836
Tags: graphs Correct Solution: ``` """ Brandt Smith, Lemuel Gorion and Peter Haddad codeforces.com Problem 22C """ import sys n, m, v = input().split(' ') n = int(n) m = int(m) v = int(v) arr = [int(x) for x in range(n+1)] if n - 1 > m or m > ( (n - 1) * (n - 2) / 2 + 1 ): print(-1) sys.exit() else...
output
1
11,918
14
23,837