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 a correct Python 3 solution for this coding contest problem.
There are N pinholes on the xy-plane. The i-th pinhole is located at (x_i,y_i).
We will denote the Manhattan distance between the i-th and j-th pinholes as d(i,j)(=|x_i-x_j|+|y_i-y_j|).
You have a peculiar pair of compasses, called Manhattan Compas... | instruction | 0 | 1,569 | 3 | 3,138 |
"Correct Solution:
```
import bisect
import sys
from collections import defaultdict
class RandomizedBinarySearchTree:
def __init__(self):
self.children = [[-1], [-1]]
self.values = [0]
self.counts = [0]
self.root = 0
def merge(self, left_root, right_root):
children = s... | output | 1 | 1,569 | 3 | 3,139 |
Provide a correct Python 3 solution for this coding contest problem.
There are N pinholes on the xy-plane. The i-th pinhole is located at (x_i,y_i).
We will denote the Manhattan distance between the i-th and j-th pinholes as d(i,j)(=|x_i-x_j|+|y_i-y_j|).
You have a peculiar pair of compasses, called Manhattan Compas... | instruction | 0 | 1,570 | 3 | 3,140 |
"Correct Solution:
```
N, a, b = map(int, input().split()); a -= 1; b -= 1
P = []
Q = []
for i in range(N):
x, y = map(int, input().split())
P.append((x-y, x+y, i))
Q.append((x+y, x-y, i))
d = max(abs(P[a][0] - P[b][0]), abs(P[a][1] - P[b][1]))
*parent, = range(N)
def root(x):
if x == parent[x]:
... | output | 1 | 1,570 | 3 | 3,141 |
Provide a correct Python 3 solution for this coding contest problem.
There are N pinholes on the xy-plane. The i-th pinhole is located at (x_i,y_i).
We will denote the Manhattan distance between the i-th and j-th pinholes as d(i,j)(=|x_i-x_j|+|y_i-y_j|).
You have a peculiar pair of compasses, called Manhattan Compas... | instruction | 0 | 1,571 | 3 | 3,142 |
"Correct Solution:
```
import sys
input = sys.stdin.readline
from collections import defaultdict
import bisect
INF = 10 ** 12
N,a,b = map(int,input().split())
X_to_Y = defaultdict(lambda: [-INF,INF])
Y_to_X = defaultdict(lambda: [-INF,INF])
for i in range(1,N+1):
x,y = map(int,input().split())
x,y = x+y,x-y
... | output | 1 | 1,571 | 3 | 3,143 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N pinholes on the xy-plane. The i-th pinhole is located at (x_i,y_i).
We will denote the Manhattan distance between the i-th and j-th pinholes as d(i,j)(=|x_i-x_j|+|y_i-y_j|).
You ha... | instruction | 0 | 1,572 | 3 | 3,144 |
No | output | 1 | 1,572 | 3 | 3,145 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N pinholes on the xy-plane. The i-th pinhole is located at (x_i,y_i).
We will denote the Manhattan distance between the i-th and j-th pinholes as d(i,j)(=|x_i-x_j|+|y_i-y_j|).
You ha... | instruction | 0 | 1,573 | 3 | 3,146 |
No | output | 1 | 1,573 | 3 | 3,147 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N pinholes on the xy-plane. The i-th pinhole is located at (x_i,y_i).
We will denote the Manhattan distance between the i-th and j-th pinholes as d(i,j)(=|x_i-x_j|+|y_i-y_j|).
You ha... | instruction | 0 | 1,574 | 3 | 3,148 |
No | output | 1 | 1,574 | 3 | 3,149 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N pinholes on the xy-plane. The i-th pinhole is located at (x_i,y_i).
We will denote the Manhattan distance between the i-th and j-th pinholes as d(i,j)(=|x_i-x_j|+|y_i-y_j|).
You ha... | instruction | 0 | 1,575 | 3 | 3,150 |
No | output | 1 | 1,575 | 3 | 3,151 |
Provide a correct Python 3 solution for this coding contest problem.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house.... | instruction | 0 | 1,577 | 3 | 3,154 |
"Correct Solution:
```
while True:
d, w, h = map(int, input().split())
if d == 0:
break
n = int(input())
a, b = sorted([d, w, h])[:2]
t = pow(pow(a, 2) + pow(b, 2), 0.5) // 2
for _ in range(n):
print("OK" if int(input()) > t else "NA")
``` | output | 1 | 1,577 | 3 | 3,155 |
Provide a correct Python 3 solution for this coding contest problem.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house.... | instruction | 0 | 1,578 | 3 | 3,156 |
"Correct Solution:
```
while True:
Size_lis = list(map(int,input().split()))
if Size_lis == [0,0,0]:
break
n = int(input())
Size_lis.remove(max(Size_lis))
m_r = (Size_lis[0] / 2) ** 2 + (Size_lis[1] / 2) ** 2
for i in range(n):
r = int(input())
if m_r >= r ** 2:
... | output | 1 | 1,578 | 3 | 3,157 |
Provide a correct Python 3 solution for this coding contest problem.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house.... | instruction | 0 | 1,579 | 3 | 3,158 |
"Correct Solution:
```
while 1:
try:
dwh=list(map(int,input().split()))
if dwh[0]==dwh[1]==dwh[2]==0:break
dwh.sort()
std=(dwh[0]**2+dwh[1]**2)**0.5/2
n=int(input())
for i in range(n):
r=int(input())
if std<r:print("OK")
else:print(... | output | 1 | 1,579 | 3 | 3,159 |
Provide a correct Python 3 solution for this coding contest problem.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house.... | instruction | 0 | 1,580 | 3 | 3,160 |
"Correct Solution:
```
while True:
d, w, h = (int(x) for x in input().split())
if d == 0: break
q = int(input())
vmin = min(d * d + w * w, d * d + h * h, w * w + h * h)
for i in range(0,q):
r = int(input())
ans = 'NA'
if (2 * r) ** 2 > vmin:
ans = 'OK'
print(ans)
`... | output | 1 | 1,580 | 3 | 3,161 |
Provide a correct Python 3 solution for this coding contest problem.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house.... | instruction | 0 | 1,581 | 3 | 3,162 |
"Correct Solution:
```
while 1:
cheese=list(map(int,input().split()))
if cheese[0]==0:break
n=int(input())
cheese=sorted(cheese)
for i in range(n):
radius = int(input())
if radius*2>(cheese[0]**2+cheese[1]**2)**0.5:print("OK")
else:print("NA")
``` | output | 1 | 1,581 | 3 | 3,163 |
Provide a correct Python 3 solution for this coding contest problem.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house.... | instruction | 0 | 1,582 | 3 | 3,164 |
"Correct Solution:
```
import math
output = []
while True:
depth, width, height = [int(item) for item in input().split(" ")]
if depth == 0 and width == 0 and height == 0:
break
cheeseRadius = math.sqrt((width / 2)**2 + (height / 2)**2)
inputCount = int(input())
for lp in range(inputCou... | output | 1 | 1,582 | 3 | 3,165 |
Provide a correct Python 3 solution for this coding contest problem.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house.... | instruction | 0 | 1,583 | 3 | 3,166 |
"Correct Solution:
```
while True:
d, w, h = sorted(map(int, input().split()))
if d == w == h == 0:
break
dw = (d**2 + w**2)
n = int(input())
for i in range(n):
y = int(input())
if (2*y)**2 > dw:
print("OK")
else:
print("NA")
``` | output | 1 | 1,583 | 3 | 3,167 |
Provide a correct Python 3 solution for this coding contest problem.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house.... | instruction | 0 | 1,584 | 3 | 3,168 |
"Correct Solution:
```
while 1:
a,b,_=sorted(map(int,input().split()))
if a==0:break
c=(a**2+b**2)**0.5//2
for _ in range(int(input())):print('OK' if c<int(input()) else 'NA')
``` | output | 1 | 1,584 | 3 | 3,169 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's ... | instruction | 0 | 1,585 | 3 | 3,170 |
Yes | output | 1 | 1,585 | 3 | 3,171 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's ... | instruction | 0 | 1,586 | 3 | 3,172 |
Yes | output | 1 | 1,586 | 3 | 3,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's ... | instruction | 0 | 1,587 | 3 | 3,174 |
Yes | output | 1 | 1,587 | 3 | 3,175 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's ... | instruction | 0 | 1,588 | 3 | 3,176 |
Yes | output | 1 | 1,588 | 3 | 3,177 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's ... | instruction | 0 | 1,589 | 3 | 3,178 |
No | output | 1 | 1,589 | 3 | 3,179 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's ... | instruction | 0 | 1,590 | 3 | 3,180 |
No | output | 1 | 1,590 | 3 | 3,181 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's ... | instruction | 0 | 1,591 | 3 | 3,182 |
No | output | 1 | 1,591 | 3 | 3,183 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's ... | instruction | 0 | 1,592 | 3 | 3,184 |
No | output | 1 | 1,592 | 3 | 3,185 |
Provide a correct Python 3 solution for this coding contest problem.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an object. Quaternions are $ using four real numbers $ x $, $ y ... | instruction | 0 | 1,593 | 3 | 3,186 |
"Correct Solution:
```
while 1:
n=int(input())
if n==0:break
for _ in range(n):
x1,y1,z1,w1,x2,y2,z2,w2=map(int,input().split())
print((x1*x2) - (y1*y2) -(z1*z2) -(w1*w2),
(x1*y2) + (y1*x2) + (z1*w2) - (w1*z2),
(x1*z2) - (y1*w2) + (z1*x2) + (w1*y2),
... | output | 1 | 1,593 | 3 | 3,187 |
Provide a correct Python 3 solution for this coding contest problem.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an object. Quaternions are $ using four real numbers $ x $, $ y ... | instruction | 0 | 1,594 | 3 | 3,188 |
"Correct Solution:
```
# from sys import exit
while(True):
N = int(input())
if N == 0:
break
for _ in range(N):
a, b, c, d, A, B, C, D = [int(n) for n in input().split()]
z = a*A - b*B - c*C - d*D
i = a*B + b*A + c*D - d*C
j = a*C - b*D + c*A + d*B
k = a*D + ... | output | 1 | 1,594 | 3 | 3,189 |
Provide a correct Python 3 solution for this coding contest problem.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an object. Quaternions are $ using four real numbers $ x $, $ y ... | instruction | 0 | 1,595 | 3 | 3,190 |
"Correct Solution:
```
while 1:
n = int(input())
if n == 0:
break
for _ in range(n):
data = list(map(int, input().split()))
c = data[0]*data[4] - data[1]*data[5] - \
data[2]*data[6] - data[3]*data[7]
i = data[0]*data[5] + data[1]*data[4] + \
data[2]*d... | output | 1 | 1,595 | 3 | 3,191 |
Provide a correct Python 3 solution for this coding contest problem.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an object. Quaternions are $ using four real numbers $ x $, $ y ... | instruction | 0 | 1,596 | 3 | 3,192 |
"Correct Solution:
```
while 1:
N = int(input())
if N == 0:
break
P = [
[1, 2, 3, 4],
[2, -1, 4, -3],
[3, -4, -1, 2],
[4, 3, -2, -1],
]
for i in range(N):
*X, = map(int, input().split())
X0 = X[:4]; X1 = X[4:]
Y = [0]*4
for i, x... | output | 1 | 1,596 | 3 | 3,193 |
Provide a correct Python 3 solution for this coding contest problem.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an object. Quaternions are $ using four real numbers $ x $, $ y ... | instruction | 0 | 1,597 | 3 | 3,194 |
"Correct Solution:
```
import sys
f = sys.stdin
index = [[0,1,2,3],
[1,0,3,2],
[2,3,0,1],
[3,2,1,0]]
sign = [[1, 1, 1, 1],
[1,-1, 1,-1],
[1,-1,-1, 1],
[1, 1,-1,-1]]
while True:
n = int(f.readline())
if n == 0:
break
for _ in range(n):
... | output | 1 | 1,597 | 3 | 3,195 |
Provide a correct Python 3 solution for this coding contest problem.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an object. Quaternions are $ using four real numbers $ x $, $ y ... | instruction | 0 | 1,598 | 3 | 3,196 |
"Correct Solution:
```
b = [[1,2,3,4],[2,-1,4,-3],[3,-4,-1,2],[4,3,-2,-1]]
while 1:
n = int(input())
if n == 0:break
for _ in range(n):
x = tuple(map(int, input().split()))
x1, x2 = x[:4], x[4:]
a = [0,0,0,0]
for i in range(4):
for j in range(4):
i... | output | 1 | 1,598 | 3 | 3,197 |
Provide a correct Python 3 solution for this coding contest problem.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an object. Quaternions are $ using four real numbers $ x $, $ y ... | instruction | 0 | 1,599 | 3 | 3,198 |
"Correct Solution:
```
while True :
n = int(input())
if n == 0 :
break
for i in range(n) :
x1, y1, z1, w1, x2, y2, z2, w2 = map(int, input().split())
print((x1*x2 - y1*y2 - z1*z2 - w1*w2), (x1*y2 + x2*y1 + z1*w2 - z2*w1), (x1*z2 - y1*w2 + x2*z1 + y2*w1), (x1*w2 + y1*z2 - y2*z1 ... | output | 1 | 1,599 | 3 | 3,199 |
Provide a correct Python 3 solution for this coding contest problem.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an object. Quaternions are $ using four real numbers $ x $, $ y ... | instruction | 0 | 1,600 | 3 | 3,200 |
"Correct Solution:
```
while 1:
n=int(input())
if n==0:break
ans=[0]*(n+1)**2
for i in range(0,n):
a,b,c,d,e,f,g,h=map(int,input().split())
print(a*e-b*f-c*g-d*h,a*f+b*e+c*h-d*g,a*g-b*h+c*e+d*f,a*h+b*g-c*f+d*e)
``` | output | 1 | 1,600 | 3 | 3,201 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an objec... | instruction | 0 | 1,601 | 3 | 3,202 |
Yes | output | 1 | 1,601 | 3 | 3,203 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an objec... | instruction | 0 | 1,602 | 3 | 3,204 |
Yes | output | 1 | 1,602 | 3 | 3,205 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an objec... | instruction | 0 | 1,603 | 3 | 3,206 |
Yes | output | 1 | 1,603 | 3 | 3,207 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an objec... | instruction | 0 | 1,604 | 3 | 3,208 |
Yes | output | 1 | 1,604 | 3 | 3,209 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an objec... | instruction | 0 | 1,605 | 3 | 3,210 |
No | output | 1 | 1,605 | 3 | 3,211 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an objec... | instruction | 0 | 1,606 | 3 | 3,212 |
No | output | 1 | 1,606 | 3 | 3,213 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an objec... | instruction | 0 | 1,607 | 3 | 3,214 |
No | output | 1 | 1,607 | 3 | 3,215 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An extension of a complex number is called a quaternion. It is a convenient number that can be used to control the arm of a robot because it is convenient for expressing the rotation of an objec... | instruction | 0 | 1,608 | 3 | 3,216 |
No | output | 1 | 1,608 | 3 | 3,217 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to find something to occupy herself. She couldn't ... | instruction | 0 | 1,651 | 3 | 3,302 |
Tags: binary search, interactive
Correct Solution:
```
from sys import stdin
from math import *
from sys import stdout
line = stdin.readline().rstrip().split()
m = int(line[0])
n = int(line[1])
bits = []
for i in range(n):
print(m)
stdout.flush()
line = stdin.readline().rstrip().split()
res = int(line... | output | 1 | 1,651 | 3 | 3,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to ... | instruction | 0 | 1,652 | 3 | 3,304 |
No | output | 1 | 1,652 | 3 | 3,305 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to ... | instruction | 0 | 1,653 | 3 | 3,306 |
No | output | 1 | 1,653 | 3 | 3,307 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to ... | instruction | 0 | 1,654 | 3 | 3,308 |
No | output | 1 | 1,654 | 3 | 3,309 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to ... | instruction | 0 | 1,655 | 3 | 3,310 |
No | output | 1 | 1,655 | 3 | 3,311 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.
The reserve must have a form of a ci... | instruction | 0 | 1,673 | 3 | 3,346 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
from sys import exit
from math import sqrt
eps = 1e-9
def mysqrt(x):
if x <= 0:
return 0
return sqrt(x)
def good(R):
global xs
global ys
global n
left = -10**20
right = 10**20
for i in range(n):
... | output | 1 | 1,673 | 3 | 3,347 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.
The reserve must have a form of a ci... | instruction | 0 | 1,674 | 3 | 3,348 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
import math
n = int(input())
points = []
npt = 0
for i in range(n):
point = list(map(int, input().split()))
if point[1] < 0:
npt += 1
point[1] = -point[1]
points.append(point)
if npt < n and npt > 0:
print(-1)
else:
... | output | 1 | 1,674 | 3 | 3,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.
The reserve must have a form of a ci... | instruction | 0 | 1,675 | 3 | 3,350 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
def bs(x,y,n,p):
r=0
for i in range(n):
#z= (0.5*((x[i]-p)**2 +(y[i])**2))/y[i]
z=(p-x[i])*(p-x[i]) + 1.0*y[i]*y[i]
z=z/2.0
z=z/y[i]
z=abs(z)
... | output | 1 | 1,675 | 3 | 3,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.
The reserve must have a form of a ci... | instruction | 0 | 1,676 | 3 | 3,352 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r... | output | 1 | 1,676 | 3 | 3,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.
The reserve must have a form of a ci... | instruction | 0 | 1,677 | 3 | 3,354 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
def check(mid):
mx=0
for i in range(n):
mx=max(mx,(x[i]-mid)**2/(2*y[i])+(y[i]/2))
return mx
n=int(input())
l=-100000000
r= 100000000
x=[]
y=[]
c1,c2=0,0
for i in range(n):
a,b=map(int,input().split())
if b>=0:
c1+=... | output | 1 | 1,677 | 3 | 3,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.
The reserve must have a form of a ci... | instruction | 0 | 1,678 | 3 | 3,356 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
import math
n = int(input())
points = []
npt = 0
for i in range(n):
point = list(map(int, input().split()))
if point[1] < 0:
npt += 1
point[1] = -point[1]
points.append(point)
if npt < n and npt > 0:
print(-1)
else:
... | output | 1 | 1,678 | 3 | 3,357 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.