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.
Stellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space coordinates of the enemy are already known, and the "feat... | instruction | 0 | 68,841 | 3 | 137,682 |
"Correct Solution:
```
def det(a,b,c):
return a[0]*b[1]*c[2] + a[2]*b[0]*c[1] + a[1]*b[2]*c[0] - a[2]*b[1]*c[0] - a[1]*b[0]*c[2] - a[0]*b[2]*c[1]
uaz = list(map(int, input().split()))
ene = list(map(int, input().split()))
br1 = list(map(int, input().split()))
br2 = list(map(int, input().split()))
br3 = list(map(in... | output | 1 | 68,841 | 3 | 137,683 |
Provide a correct Python 3 solution for this coding contest problem.
Stellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space coordinates of the enemy are already known, and the "feat... | instruction | 0 | 68,842 | 3 | 137,684 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
import os
import math
import random
# refs
# https://shikousakugo.wordpress.com/2012/06/27/ray-intersection-2/
def det(a, b, c):
return + a[0] * b[1] * c[2] \
+ a[2] * b[0] * c[1] \
+ a[1] * b[2] * c[0] \
- a[2] * b[1] * c... | output | 1 | 68,842 | 3 | 137,685 |
Provide a correct Python 3 solution for this coding contest problem.
Stellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space coordinates of the enemy are already known, and the "feat... | instruction | 0 | 68,843 | 3 | 137,686 |
"Correct Solution:
```
def get_det(a, b, c):
a1, a2, a3 = a
b1, b2, b3 = b
c1, c2, c3 = c
return a1 * b2 * c3 + a3 * b1 * c2 + a2 * b3 * c1 \
- a3 * b2 * c1 - a2 * b1 * c3 - a1 * b3 * c2
def solve():
import sys
f_i = sys.stdin
Sx, Sy, Sz = map(int, f_i.readline().split())
... | output | 1 | 68,843 | 3 | 137,687 |
Provide a correct Python 3 solution for this coding contest problem.
Stellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space coordinates of the enemy are already known, and the "feat... | instruction | 0 | 68,844 | 3 | 137,688 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
import os
import math
import random
# refs
# https://shikousakugo.wordpress.com/2012/06/27/ray-intersection-2/
def det(a, b, c):
return + a[0] * b[1] * c[2] \
+ a[2] * b[0] * c[1] \
+ a[1] * b[2] * c[0] \
- a[2] * b[1] * c... | output | 1 | 68,844 | 3 | 137,689 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Stellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space c... | instruction | 0 | 68,845 | 3 | 137,690 |
No | output | 1 | 68,845 | 3 | 137,691 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Stellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space c... | instruction | 0 | 68,846 | 3 | 137,692 |
No | output | 1 | 68,846 | 3 | 137,693 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Stellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space c... | instruction | 0 | 68,847 | 3 | 137,694 |
No | output | 1 | 68,847 | 3 | 137,695 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Stellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space c... | instruction | 0 | 68,848 | 3 | 137,696 |
No | output | 1 | 68,848 | 3 | 137,697 |
Provide a correct Python 3 solution for this coding contest problem.
Many cats live on the campus of a school. Natsume's daily routine is to pet those cats. However, the cats may be capricious and go for a walk off campus.
The campus site is a rectangle with each side parallel to the x-axis or y-axis and is surrounde... | instruction | 0 | 68,882 | 3 | 137,764 |
"Correct Solution:
```
n = int(input())
for _ in range(n):
x1, y1, w, h = map(int, input().split())
x2 = x1 + w
y2 = y1 + h
m = int(input())
cnt = 0
for _ in range(m):
x, y = map(int, input().split())
if x1 <= x <= x2 and y1 <= y <= y2:
cnt += 1
print(cnt)
``` | output | 1 | 68,882 | 3 | 137,765 |
Provide a correct Python 3 solution for this coding contest problem.
Many cats live on the campus of a school. Natsume's daily routine is to pet those cats. However, the cats may be capricious and go for a walk off campus.
The campus site is a rectangle with each side parallel to the x-axis or y-axis and is surrounde... | instruction | 0 | 68,883 | 3 | 137,766 |
"Correct Solution:
```
d = int(input())
for _ in range(d):
x, y, w, h = map(int, input().split())
n = int(input())
ans = 0
for i in range(n):
cx, cy = map(int, input().split())
if x <= cx <= x + w and y <= cy <= y + h:
ans += 1
print(ans)
``` | output | 1 | 68,883 | 3 | 137,767 |
Provide a correct Python 3 solution for this coding contest problem.
Many cats live on the campus of a school. Natsume's daily routine is to pet those cats. However, the cats may be capricious and go for a walk off campus.
The campus site is a rectangle with each side parallel to the x-axis or y-axis and is surrounde... | instruction | 0 | 68,884 | 3 | 137,768 |
"Correct Solution:
```
for _ in range(int(input())):
x, y, w, h = map(int,input().split())
c = 0
for _ in range(int(input())):
a, b = map(int,input().split())
if x <= a and a <= x + w and y <= b and b <= y + h:c += 1
print(c)
``` | output | 1 | 68,884 | 3 | 137,769 |
Provide a correct Python 3 solution for this coding contest problem.
Many cats live on the campus of a school. Natsume's daily routine is to pet those cats. However, the cats may be capricious and go for a walk off campus.
The campus site is a rectangle with each side parallel to the x-axis or y-axis and is surrounde... | instruction | 0 | 68,885 | 3 | 137,770 |
"Correct Solution:
```
for _ in range(int(input())):
x,y,w,h=map(int,input().split())
c=0
for _ in range(int(input())):
a,b=map(int,input().split())
if x<=a<=x+w and y<=b<=y+h:c+=1
print(c)
``` | output | 1 | 68,885 | 3 | 137,771 |
Provide a correct Python 3 solution for this coding contest problem.
Many cats live on the campus of a school. Natsume's daily routine is to pet those cats. However, the cats may be capricious and go for a walk off campus.
The campus site is a rectangle with each side parallel to the x-axis or y-axis and is surrounde... | instruction | 0 | 68,886 | 3 | 137,772 |
"Correct Solution:
```
for _ in range(int(input())):
X,Y,W,H= map(int, input().split())
x1,y1,x2,y2=X,Y,X+W,Y+H
cnt=0
for _ in range(int(input())):
x,y= map(int, input().split())
if (x>=x1 and x<=x2) and (y>=y1 and y<=y2):
cnt+=1
print(cnt)
``` | output | 1 | 68,886 | 3 | 137,773 |
Provide a correct Python 3 solution for this coding contest problem.
Many cats live on the campus of a school. Natsume's daily routine is to pet those cats. However, the cats may be capricious and go for a walk off campus.
The campus site is a rectangle with each side parallel to the x-axis or y-axis and is surrounde... | instruction | 0 | 68,887 | 3 | 137,774 |
"Correct Solution:
```
d=int(input())
for i in range(d):
X,Y,W,H=map(int,input().split())
count=0
n=int(input())
for j in range(n):
x,y=map(int,input().split())
if X<=x<=X+W and Y<=y<=Y+H:count+=1
print(count)
``` | output | 1 | 68,887 | 3 | 137,775 |
Provide a correct Python 3 solution for this coding contest problem.
Many cats live on the campus of a school. Natsume's daily routine is to pet those cats. However, the cats may be capricious and go for a walk off campus.
The campus site is a rectangle with each side parallel to the x-axis or y-axis and is surrounde... | instruction | 0 | 68,888 | 3 | 137,776 |
"Correct Solution:
```
t = int(input())
for _ in range(t):
x, y, w, h = map(int, input().split())
n = int(input())
ans = 0
for _ in range(n):
cx, cy = map(int, input().split())
if x <= cx <= x + w and y <= cy <= y + h:
ans += 1
print(ans)
``` | output | 1 | 68,888 | 3 | 137,777 |
Provide a correct Python 3 solution for this coding contest problem.
Run, Twins
E869120 You started running from home to school at a speed of $ P $ meters per minute.
square1001 noticed E869120's forgotten thing $ A $ minutes after E869120 left home and chased at $ Q $ meters per minute.
Then E869120 noticed someth... | instruction | 0 | 68,893 | 3 | 137,786 |
"Correct Solution:
```
a, b = map(int, input().split())
p, q, r = map(int, input().split())
x = b + (p*b-q*(b-a)) / (q+r)
print(x)
``` | output | 1 | 68,893 | 3 | 137,787 |
Provide a correct Python 3 solution for this coding contest problem.
Run, Twins
E869120 You started running from home to school at a speed of $ P $ meters per minute.
square1001 noticed E869120's forgotten thing $ A $ minutes after E869120 left home and chased at $ Q $ meters per minute.
Then E869120 noticed someth... | instruction | 0 | 68,894 | 3 | 137,788 |
"Correct Solution:
```
a, b=map(int, input().split())
p, q, r=map(int, input().split())
print((p*b+q*a+r*b)/(q+r))
``` | output | 1 | 68,894 | 3 | 137,789 |
Provide a correct Python 3 solution for this coding contest problem.
Run, Twins
E869120 You started running from home to school at a speed of $ P $ meters per minute.
square1001 noticed E869120's forgotten thing $ A $ minutes after E869120 left home and chased at $ Q $ meters per minute.
Then E869120 noticed someth... | instruction | 0 | 68,895 | 3 | 137,790 |
"Correct Solution:
```
a, b = [int(_) for _ in input().split()]
p, q, r = [int(_) for _ in input().split()]
print(b + (b*p - (b-a)*q) / (q + r))
``` | output | 1 | 68,895 | 3 | 137,791 |
Provide a correct Python 3 solution for this coding contest problem.
Run, Twins
E869120 You started running from home to school at a speed of $ P $ meters per minute.
square1001 noticed E869120's forgotten thing $ A $ minutes after E869120 left home and chased at $ Q $ meters per minute.
Then E869120 noticed someth... | instruction | 0 | 68,896 | 3 | 137,792 |
"Correct Solution:
```
A, B = map(int,input().split())
P, Q, R = map(int,input().split())
print((B*(P+R)+A*Q)/(R+Q))
``` | output | 1 | 68,896 | 3 | 137,793 |
Provide a correct Python 3 solution for this coding contest problem.
Run, Twins
E869120 You started running from home to school at a speed of $ P $ meters per minute.
square1001 noticed E869120's forgotten thing $ A $ minutes after E869120 left home and chased at $ Q $ meters per minute.
Then E869120 noticed someth... | instruction | 0 | 68,897 | 3 | 137,794 |
"Correct Solution:
```
a,b=map(int,input().split())
p,q,r=map(int,input().split())
t=b*p-(b-a)*q
print(t/(q+r)+b)
``` | output | 1 | 68,897 | 3 | 137,795 |
Provide a correct Python 3 solution for this coding contest problem.
Run, Twins
E869120 You started running from home to school at a speed of $ P $ meters per minute.
square1001 noticed E869120's forgotten thing $ A $ minutes after E869120 left home and chased at $ Q $ meters per minute.
Then E869120 noticed someth... | instruction | 0 | 68,898 | 3 | 137,796 |
"Correct Solution:
```
A,B=map(int,input().split())
P,Q,R=map(int,input().split())
print((B*(P-Q)+Q*A)/(Q+R)+B)
``` | output | 1 | 68,898 | 3 | 137,797 |
Provide a correct Python 3 solution for this coding contest problem.
Run, Twins
E869120 You started running from home to school at a speed of $ P $ meters per minute.
square1001 noticed E869120's forgotten thing $ A $ minutes after E869120 left home and chased at $ Q $ meters per minute.
Then E869120 noticed someth... | instruction | 0 | 68,899 | 3 | 137,798 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10 ** 6)
def MI(): return map(int, sys.stdin.readline().split())
def main():
a,b=MI()
p,q,r=MI()
print((p*b+a*q+r*b)/(q+r))
main()
``` | output | 1 | 68,899 | 3 | 137,799 |
Provide a correct Python 3 solution for this coding contest problem.
Run, Twins
E869120 You started running from home to school at a speed of $ P $ meters per minute.
square1001 noticed E869120's forgotten thing $ A $ minutes after E869120 left home and chased at $ Q $ meters per minute.
Then E869120 noticed someth... | instruction | 0 | 68,900 | 3 | 137,800 |
"Correct Solution:
```
a,b = map(int,input().split())
p,q,r= map(int,input().split())
#後に出会う
d = p*b-(b-a)*q
print(d/(q+r)+b)
``` | output | 1 | 68,900 | 3 | 137,801 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks.... | instruction | 0 | 68,959 | 3 | 137,918 |
Tags: brute force, constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
obelisk = [list(map(int, input().split())) for _ in range(n)]
clues = [tuple(map(int, input().split())) for _ in range(n)]
d = set(clues)
first = obelisk[0]
for clue in clues:
treasure = [0, 0]
treasure[... | output | 1 | 68,959 | 3 | 137,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks.... | instruction | 0 | 68,960 | 3 | 137,920 |
Tags: brute force, constructive algorithms, greedy, implementation
Correct Solution:
```
obilisks = int(input())
xtreasure = 0;
ytreasure = 0;
for i in range(obilisks+obilisks):
xpos, ypos = [int(x) for x in input().split()]
xtreasure += xpos
ytreasure += ypos
print(xtreasure//obilisks, ytreasure//obilisks)... | output | 1 | 68,960 | 3 | 137,921 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks.... | instruction | 0 | 68,961 | 3 | 137,922 |
Tags: brute force, constructive algorithms, greedy, implementation
Correct Solution:
```
n=int(input())
Overallx=[]
Overally=[]
for i in range(0,n):
x,y=[int(x) for x in input().split()]
Overallx.append(x)
Overally.append(y)
for i in range(0,n):
x,y=[int(x) for x in input().split()]
Overallx.append(... | output | 1 | 68,961 | 3 | 137,923 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks.... | instruction | 0 | 68,962 | 3 | 137,924 |
Tags: brute force, constructive algorithms, greedy, implementation
Correct Solution:
```
from collections import Counter
def read():
return int(input())
def readlist():
return list(map(int, input().split()))
def readmap():
return map(int, input().split())
n = read()
X = []
Y = []
for _ in range(n):
... | output | 1 | 68,962 | 3 | 137,925 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks.... | instruction | 0 | 68,963 | 3 | 137,926 |
Tags: brute force, constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
ob = []
q = []
for i in range(n):
ob.append(list(map(int, input().split())))
for i in range(n):
q.append(list(map(int, input().split())))
ob.sort()
q.sort(reverse=True)
print(ob[0][0] + q[0][0], ob[0][1] + ... | output | 1 | 68,963 | 3 | 137,927 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks.... | instruction | 0 | 68,964 | 3 | 137,928 |
Tags: brute force, constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
summ1 = 0
summ2 = 0
for i in range(2 * n):
k, m = map(int, input().split())
summ1 += k
summ2 += m
print(summ1 // n, summ2 // n)
``` | output | 1 | 68,964 | 3 | 137,929 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks.... | instruction | 0 | 68,965 | 3 | 137,930 |
Tags: brute force, constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input().strip())
xm,ym = (0,0)
for i in range(2*n):
x,y = list(map(int,input().strip().split()))
xm+=x
ym+=y
print(xm//(n), ym//(n))
``` | output | 1 | 68,965 | 3 | 137,931 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks.... | instruction | 0 | 68,966 | 3 | 137,932 |
Tags: brute force, constructive algorithms, greedy, implementation
Correct Solution:
```
n=int(input())
R=lambda:sorted([*map(int,input().split())]for _ in[0]*n)
o,c=R(),R()
print(o[0][0]+c[-1][0],o[0][1]+c[-1][1])
``` | output | 1 | 68,966 | 3 | 137,933 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collecte... | instruction | 0 | 68,967 | 3 | 137,934 |
Yes | output | 1 | 68,967 | 3 | 137,935 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collecte... | instruction | 0 | 68,968 | 3 | 137,936 |
Yes | output | 1 | 68,968 | 3 | 137,937 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collecte... | instruction | 0 | 68,969 | 3 | 137,938 |
Yes | output | 1 | 68,969 | 3 | 137,939 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collecte... | instruction | 0 | 68,970 | 3 | 137,940 |
Yes | output | 1 | 68,970 | 3 | 137,941 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collecte... | instruction | 0 | 68,971 | 3 | 137,942 |
No | output | 1 | 68,971 | 3 | 137,943 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collecte... | instruction | 0 | 68,972 | 3 | 137,944 |
No | output | 1 | 68,972 | 3 | 137,945 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collecte... | instruction | 0 | 68,973 | 3 | 137,946 |
No | output | 1 | 68,973 | 3 | 137,947 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collecte... | instruction | 0 | 68,974 | 3 | 137,948 |
No | output | 1 | 68,974 | 3 | 137,949 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an identity permutation (make p_i = i for all i).
... | instruction | 0 | 69,155 | 3 | 138,310 |
Tags: constructive algorithms, greedy
Correct Solution:
```
for tests in range(int(input())):
n=int(input())
AA=[]
for i in range((n+2)//2,n):
AA.append((1,i))
for i in range((n+2)//2-1,0,-1):
AA.append((i,n))
L=list(range(1,n+1))
sc=0
for x,y in AA[::-1]:L[x-1],L[... | output | 1 | 69,155 | 3 | 138,311 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an identity permutation (make p_i = i for all i).
... | instruction | 0 | 69,156 | 3 | 138,312 |
Tags: constructive algorithms, greedy
Correct Solution:
```
from collections import defaultdict
from itertools import accumulate
import sys
input = sys.stdin.readline
'''
for CASES in range(int(input())):
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
sys.stdo... | output | 1 | 69,156 | 3 | 138,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an identity permutation (make p_i = i for all i).
... | instruction | 0 | 69,157 | 3 | 138,314 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import sys
input = sys.stdin.readline
t=int(input())
for tests in range(t):
n=int(input())
AA=[]
for i in range((n+2)//2,n):
AA.append((1,i))
for i in range((n+2)//2-1,0,-1):
AA.append((i,n))
L=list(range(1,n+1))
... | output | 1 | 69,157 | 3 | 138,315 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an identity permutation (make p_i = i for all i).
... | instruction | 0 | 69,158 | 3 | 138,316 |
Tags: constructive algorithms, greedy
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
a = list(range(1, n + 1))
ans = (n - 1)**2
for i in range(1, n - 1):
ans += max(i, n - i - 1)**2
pos = list(range(n - 1))
pos.sort(key=lambda i: min(i, n - i - 1))
ops = []
for i in pos:
if i * 2 < n:
... | output | 1 | 69,158 | 3 | 138,317 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an identity permutation (make p_i = i for all i).
... | instruction | 0 | 69,159 | 3 | 138,318 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import sys
readline = sys.stdin.readline
def parorder(Edge, p):
N = len(Edge)
par = [0]*N
par[p] = -1
stack = [p]
order = []
visited = set([p])
ast = stack.append
apo = order.append
while stack:
vn = stack.pop()
... | output | 1 | 69,159 | 3 | 138,319 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an identity permutation (make p_i = i for all i).
... | instruction | 0 | 69,160 | 3 | 138,320 |
Tags: constructive algorithms, greedy
Correct Solution:
```
def ints():
return list(map(int, input().split()))
def go():
n, = ints()
if n <= 3:
print(sum(i**2 for i in range(n)))
print(' '.join(map(str, range(2, n+1))), 1)
print(n-1)
for i in range(1, n):
print(i... | output | 1 | 69,160 | 3 | 138,321 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an identity permutation (make p_i = i for all i).
... | instruction | 0 | 69,161 | 3 | 138,322 |
Tags: constructive algorithms, greedy
Correct Solution:
```
# Author: yumtam
# Created at: 2021-03-02 22:32
def solve():
n = int(input())
A = list(range(1, n+1))
ops = []
ans = 0
def process(i, j):
nonlocal ans
A[i], A[j] = A[j], A[i]
ops.append((i+1, j+1))
ans... | output | 1 | 69,161 | 3 | 138,323 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an identity permutation (make p_i = i for all i).
... | instruction | 0 | 69,162 | 3 | 138,324 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import sys
input=sys.stdin.readline
t = int(input())
for _ in range(t):
n = int(input())
time = 0
integer = [i for i in range(1,n+1)]
l = []
for i in range(n//2,n):
time += i**2
integer[0],integer[i] = integer[i],inte... | output | 1 | 69,162 | 3 | 138,325 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an i... | instruction | 0 | 69,163 | 3 | 138,326 |
Yes | output | 1 | 69,163 | 3 | 138,327 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an i... | instruction | 0 | 69,164 | 3 | 138,328 |
Yes | output | 1 | 69,164 | 3 | 138,329 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation p of length n. Scientists found out, that to overcome an obstacle, the robot should make p an i... | instruction | 0 | 69,165 | 3 | 138,330 |
Yes | output | 1 | 69,165 | 3 | 138,331 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.