message stringlengths 2 433k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 113 108k | cluster float64 12 12 | __index_level_0__ int64 226 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this problem, a n Γ m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for ... | instruction | 0 | 66,541 | 12 | 133,082 |
Yes | output | 1 | 66,541 | 12 | 133,083 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this problem, a n Γ m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for ... | instruction | 0 | 66,542 | 12 | 133,084 |
Yes | output | 1 | 66,542 | 12 | 133,085 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this problem, a n Γ m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for ... | instruction | 0 | 66,543 | 12 | 133,086 |
Yes | output | 1 | 66,543 | 12 | 133,087 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this problem, a n Γ m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for ... | instruction | 0 | 66,544 | 12 | 133,088 |
No | output | 1 | 66,544 | 12 | 133,089 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this problem, a n Γ m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for ... | instruction | 0 | 66,545 | 12 | 133,090 |
No | output | 1 | 66,545 | 12 | 133,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this problem, a n Γ m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for ... | instruction | 0 | 66,546 | 12 | 133,092 |
No | output | 1 | 66,546 | 12 | 133,093 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this problem, a n Γ m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for ... | instruction | 0 | 66,547 | 12 | 133,094 |
No | output | 1 | 66,547 | 12 | 133,095 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each position i from 1 to n you want to know the mini... | instruction | 0 | 66,549 | 12 | 133,098 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
n = int(input())
a = list(map(int,input().split()))
e = [[] for i in range(n)]
for i in range(n):
v = a[i]
if i - v >= 0:
e[i - v].append(i)
if i + v < n:
e[i + v].append(i)
q = [0]*n
res = [-1]*n
for rem in range(2):
d = [None]*n
ql = 0
qr ... | output | 1 | 66,549 | 12 | 133,099 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each position i from 1 to n you want to know the mini... | instruction | 0 | 66,550 | 12 | 133,100 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
import sys
input = sys.stdin.readline
from collections import deque
N = 2*10**5 + 5
g = [[] for _ in range(N)]
n = int(input())
a = list(map(int, input().split()))
dist = [10**9]*N
for i in range(n):
if i - a[i] >= 0:
g[i-a[i]].append(i)
if a[i-a[... | output | 1 | 66,550 | 12 | 133,101 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each position i from 1 to n you want to know the mini... | instruction | 0 | 66,551 | 12 | 133,102 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
import sys
from sys import stdin
from collections import deque
n = int(stdin.readline())
a = list(map(int,stdin.readline().split()))
lis = [ [] for i in range(n) ]
d = [float("inf")] * n
q = deque([])
for i in range(n):
if ( 0 <= i-a[i] and a[i... | output | 1 | 66,551 | 12 | 133,103 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each position i from 1 to n you want to know the mini... | instruction | 0 | 66,552 | 12 | 133,104 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
from collections import deque
import sys
input = sys.stdin.readline
def bfs0(s):
q = deque()
dist = [inf] * n
for i in s:
q.append(i)
dist[i] = 0
while q:
i = q.popleft()
di = dist[i]
for j in G[... | output | 1 | 66,552 | 12 | 133,105 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each position i from 1 to n you want to know the mini... | instruction | 0 | 66,553 | 12 | 133,106 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
n = int(input())
parities = list(map(int, input().strip().split()))
first_layer = []
ans = [-1 for i in range(n)]
hopTo = [[] for i in range(n)]
for i in range(n):
appended = False
if i - parities[i] >= 0:
hopTo[i - parities[i]].append(... | output | 1 | 66,553 | 12 | 133,107 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each position i from 1 to n you want to know the mini... | instruction | 0 | 66,554 | 12 | 133,108 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
# ------------------- fast io --------------------
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 = BytesI... | output | 1 | 66,554 | 12 | 133,109 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each position i from 1 to n you want to know the mini... | instruction | 0 | 66,555 | 12 | 133,110 |
Tags: dfs and similar, graphs, shortest paths
Correct Solution:
```
from sys import stdin,stdout
from collections import deque
n = int(stdin.readline().strip())
alist = list(map(int, stdin.readline().split()))
nop = {}
p = [set() for _ in range(n)]
def back(next):
while next:
i,c = next.popleft()
... | output | 1 | 66,555 | 12 | 133,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each p... | instruction | 0 | 66,556 | 12 | 133,112 |
Yes | output | 1 | 66,556 | 12 | 133,113 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each p... | instruction | 0 | 66,558 | 12 | 133,116 |
Yes | output | 1 | 66,558 | 12 | 133,117 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each p... | instruction | 0 | 66,559 | 12 | 133,118 |
Yes | output | 1 | 66,559 | 12 | 133,119 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each p... | instruction | 0 | 66,560 | 12 | 133,120 |
No | output | 1 | 66,560 | 12 | 133,121 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each p... | instruction | 0 | 66,561 | 12 | 133,122 |
No | output | 1 | 66,561 | 12 | 133,123 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each p... | instruction | 0 | 66,562 | 12 | 133,124 |
No | output | 1 | 66,562 | 12 | 133,125 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make array a consist of n - 1 ones and 1 two in no mor... | instruction | 0 | 66,656 | 12 | 133,312 |
Tags: brute force, constructive algorithms, math, number theory
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
inp = lambda: list(map(int,sys.stdin.readline().rstrip("\r\n").split()))
#_________________________________________________________________________________________________... | output | 1 | 66,656 | 12 | 133,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make array a consist of n - 1 ones and 1 two in no mor... | instruction | 0 | 66,657 | 12 | 133,314 |
Tags: brute force, constructive algorithms, math, number theory
Correct Solution:
```
from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect... | output | 1 | 66,657 | 12 | 133,315 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make array a consist of n - 1 ones and 1 two in no mor... | instruction | 0 | 66,658 | 12 | 133,316 |
Tags: brute force, constructive algorithms, math, number theory
Correct Solution:
```
from math import ceil, sqrt
t = int(input())
for i in range(t):
n = int(input())
keep = []
temp_n = n
while temp_n >= 3:
keep.append(temp_n)
temp_n = ceil(sqrt(temp_n))
keep.append(2)
print(n ... | output | 1 | 66,658 | 12 | 133,317 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make array a consist of n - 1 ones and 1 two in no mor... | instruction | 0 | 66,659 | 12 | 133,318 |
Tags: brute force, constructive algorithms, math, number theory
Correct Solution:
```
import sys
input = sys.stdin.readline
import math
t = int(input())
for _ in range(t):
n = int(input())
a = [0]+list(range(1, n+1))
ans = []
cnt = 0
for i in range(n-1, 2, -1):
if i*i < a[n]:
a... | output | 1 | 66,659 | 12 | 133,319 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make array a consist of n - 1 ones and 1 two in no mor... | instruction | 0 | 66,660 | 12 | 133,320 |
Tags: brute force, constructive algorithms, math, number theory
Correct Solution:
```
import math
def move2(n):
move=0
while n!=1:
n=math.ceil(n/2)
move+=1
return move
def moven(n,k):
move=0
while n!=1:
n=math.ceil(n/k)
move+=1
return move
def solve():
n=int(... | output | 1 | 66,660 | 12 | 133,321 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make array a consist of n - 1 ones and 1 two in no mor... | instruction | 0 | 66,661 | 12 | 133,322 |
Tags: brute force, constructive algorithms, math, number theory
Correct Solution:
```
from sys import stdin,stdout #
import math #
import heapq #
#
t = 1 ... | output | 1 | 66,661 | 12 | 133,323 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make array a consist of n - 1 ones and 1 two in no mor... | instruction | 0 | 66,662 | 12 | 133,324 |
Tags: brute force, constructive algorithms, math, number theory
Correct Solution:
```
t = int(input())
for i in range(t):
n = int(input())
if n == 3:
print(2)
print(3,2)
print(3,2)
continue
if n < 28:
num = n
temp = 0
while num > 1:
temp2 =... | output | 1 | 66,662 | 12 | 133,325 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make array a consist of n - 1 ones and 1 two in no mor... | instruction | 0 | 66,663 | 12 | 133,326 |
Tags: brute force, constructive algorithms, math, number theory
Correct Solution:
```
import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self... | output | 1 | 66,663 | 12 | 133,327 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make ar... | instruction | 0 | 66,664 | 12 | 133,328 |
Yes | output | 1 | 66,664 | 12 | 133,329 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make ar... | instruction | 0 | 66,665 | 12 | 133,330 |
Yes | output | 1 | 66,665 | 12 | 133,331 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make ar... | instruction | 0 | 66,666 | 12 | 133,332 |
Yes | output | 1 | 66,666 | 12 | 133,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make ar... | instruction | 0 | 66,667 | 12 | 133,334 |
Yes | output | 1 | 66,667 | 12 | 133,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make ar... | instruction | 0 | 66,668 | 12 | 133,336 |
No | output | 1 | 66,668 | 12 | 133,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make ar... | instruction | 0 | 66,669 | 12 | 133,338 |
No | output | 1 | 66,669 | 12 | 133,339 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make ar... | instruction | 0 | 66,670 | 12 | 133,340 |
No | output | 1 | 66,670 | 12 | 133,341 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an array a_1, a_2, ..., a_n where a_i = i.
In one step, you can choose two indices x and y (x β y) and set a_x = \leftβ (a_x)/(a_y) \rightβ (ceiling function).
Your goal is to make ar... | instruction | 0 | 66,671 | 12 | 133,342 |
No | output | 1 | 66,671 | 12 | 133,343 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The determinant of a matrix 2 Γ 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a... | instruction | 0 | 66,784 | 12 | 133,568 |
Tags: binary search, math
Correct Solution:
```
#!/usr/bin/python3
from math import sqrt
a, b = map(int, input().split())
c, d = map(int, input().split())
x = []
s = []
try:
x += [(-a*d + b*c)/(a - b - c + d)]
s += [1, 1, 1, 1]
except:
pass
try:
x += [-a/4 - b/4 + c/4 - d/4 - sqrt(a**2 + 2*a*b - ... | output | 1 | 66,784 | 12 | 133,569 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The determinant of a matrix 2 Γ 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a... | instruction | 0 | 66,785 | 12 | 133,570 |
Tags: binary search, math
Correct Solution:
```
a, b= map(int, input().split())
c, d = map(int, input().split())
if a * d - b * c == 0:
print(0)
else:
curpos = a * d - b * c >= 0
small = 0;
large = 1e18
for iteration in range(200):
avg = (small + large) / 2
works = False
for ... | output | 1 | 66,785 | 12 | 133,571 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The determinant of a matrix 2 Γ 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a... | instruction | 0 | 66,786 | 12 | 133,572 |
Tags: binary search, math
Correct Solution:
```
import sys;A,B,C,D=map(int,sys.stdin.read().split());k=max(map(abs,[A+B+C+D,A+B-C-D,A-B+C-D,A-B-C+D]))+1e-9;print((0,abs(A*D-B*C)/k)[bool(k)])
``` | output | 1 | 66,786 | 12 | 133,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The determinant of a matrix 2 Γ 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a... | instruction | 0 | 66,787 | 12 | 133,574 |
Tags: binary search, math
Correct Solution:
```
A,B,C,D=map(int,(input()+' '+input()).split());k=max(map(abs,[A+B+C+D,A+B-C-D,A-B+C-D,A-B-C+D]))+1e-9;print(abs(A*D-B*C)/k)
``` | output | 1 | 66,787 | 12 | 133,575 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The determinant of a matrix 2 Γ 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a... | instruction | 0 | 66,788 | 12 | 133,576 |
Tags: binary search, math
Correct Solution:
```
a=abs;A,B,C,D=map(int,(input()+' '+input()).split());print(a(A*D-B*C)/(max(a(A+B)+a(C+D),a(A-B)+a(C-D))+1e-9))
``` | output | 1 | 66,788 | 12 | 133,577 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The determinant of a matrix 2 Γ 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a... | instruction | 0 | 66,789 | 12 | 133,578 |
Tags: binary search, math
Correct Solution:
```
a=abs;A,B,C,D=map(int,(input()+' '+input()).split());print(a(A*D-B*C)/max(a(A+B)+a(C+D),a(A-B)+a(C-D),1e-9))
``` | output | 1 | 66,789 | 12 | 133,579 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The determinant of a matrix 2 Γ 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a... | instruction | 0 | 66,790 | 12 | 133,580 |
Tags: binary search, math
Correct Solution:
```
A,B,C,D=map(int,input().split()+input().split());k=max(map(abs,[A+B+C+D,A+B-C-D,A-B+C-D,A-B-C+D]))+1e-9;print((0,abs(A*D-B*C)/k)[bool(k)])
``` | output | 1 | 66,790 | 12 | 133,581 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The determinant of a matrix 2 Γ 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a... | instruction | 0 | 66,791 | 12 | 133,582 |
Tags: binary search, math
Correct Solution:
```
#include <bits/stdc++.h>
#define m(x,y) (x>y?x:y)
#define a(x) m(x,-(x))
#define solve() printf("%.9f",(A||B||C||D?a(A*D-B*C)/m(m(a(A+B+C+D),a(A-B+C-D)),m(a(A-B-C+D),a(A+B-C-D))):0))
#define moo main(){double A,B,C,D;std::cin>>A>>B>>C>>D;solve();}
#define _ \
0; moo = 'mo... | output | 1 | 66,791 | 12 | 133,583 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.
Filya is given an array of non-negative integers a1, a2, ..., an. First, he pick an integer x an... | instruction | 0 | 66,873 | 12 | 133,746 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
sp = list(map(int, input().split()))
t = []
if n > 2:
for el in sp:
if not el in t: t.append(el)
if len(t) > 3: print('NO'); break
else:
if len(t) == 3:
t.sort()
if t[1]-t[0] == t[2]-t[1]: print... | output | 1 | 66,873 | 12 | 133,747 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.
Filya is given an array of non-negative integers a1, a2, ..., an. First, he pick an integer x an... | instruction | 0 | 66,874 | 12 | 133,748 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
A = list(map(int,input().split()))
tf = False
ma = max(A)
mi = min(A)
sr = (ma+mi)/2
for i in A:
if i==ma or i==mi or i==sr:
tf = True
else:
print('NO')
exit()
if tf:
print('YES')
``` | output | 1 | 66,874 | 12 | 133,749 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.
Filya is given an array of non-negative integers a1, a2, ..., an. First, he pick an integer x an... | instruction | 0 | 66,875 | 12 | 133,750 |
Tags: implementation, sortings
Correct Solution:
```
#!/usr/bin/python3
n = int(input())
array = list(set(list(map(int, input().split()))))
array.sort()
if len(array) < 3:
print("YES")
elif len(array) > 3 or array[1] - array[0] != array[2] - array[1]:
print("NO")
else:
print("YES")
``` | output | 1 | 66,875 | 12 | 133,751 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.
Filya is given an array of non-negative integers a1, a2, ..., an. First, he pick an integer x an... | instruction | 0 | 66,876 | 12 | 133,752 |
Tags: implementation, sortings
Correct Solution:
```
import sys
import math
import bisect
import math
from itertools import accumulate
input = sys.stdin.readline
def inpit(): #int
return(int(input()))
def inplt(): #list
return(list(map(int,input().split())))
def inpstr(): #string
s = input()
return(l... | output | 1 | 66,876 | 12 | 133,753 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.
Filya is given an array of non-negative integers a1, a2, ..., an. First, he pick an integer x an... | instruction | 0 | 66,877 | 12 | 133,754 |
Tags: implementation, sortings
Correct Solution:
```
I=input
I()
s=sorted(set(map(int,I().split())))
t=len(s)
print(['NO','YES'][t<3or(t==3and s[0]+s[2]==s[1]*2)])
``` | output | 1 | 66,877 | 12 | 133,755 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.
Filya is given an array of non-negative integers a1, a2, ..., an. First, he pick an integer x an... | instruction | 0 | 66,878 | 12 | 133,756 |
Tags: implementation, sortings
Correct Solution:
```
import sys
n = int(input())
s = set(input().split())
s = [ i for i in s ]
if len(s) < 3:
print('YES')
sys.exit(0)
a = int(s[0])
b = int(s[1])
c = int(s[2])
if len(s) <= 3 and (((a+b)//2 == c and (a+b)%2 == 0) or ((a+c)//2 == b and (a+c)%2 == 0) or ((b+c)//2 =... | output | 1 | 66,878 | 12 | 133,757 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.