message stringlengths 2 44.5k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 276 109k | cluster float64 23 23 | __index_level_0__ int64 552 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n is the sum of the products of the correspondin... | instruction | 0 | 2,818 | 23 | 5,636 |
Tags: implementation, math
Correct Solution:
```
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('input.txt', ... | output | 1 | 2,818 | 23 | 5,637 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n... | instruction | 0 | 2,819 | 23 | 5,638 |
Yes | output | 1 | 2,819 | 23 | 5,639 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n... | instruction | 0 | 2,820 | 23 | 5,640 |
Yes | output | 1 | 2,820 | 23 | 5,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n... | instruction | 0 | 2,821 | 23 | 5,642 |
Yes | output | 1 | 2,821 | 23 | 5,643 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n... | instruction | 0 | 2,822 | 23 | 5,644 |
Yes | output | 1 | 2,822 | 23 | 5,645 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n... | instruction | 0 | 2,823 | 23 | 5,646 |
No | output | 1 | 2,823 | 23 | 5,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n... | instruction | 0 | 2,824 | 23 | 5,648 |
No | output | 1 | 2,824 | 23 | 5,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n... | instruction | 0 | 2,825 | 23 | 5,650 |
No | output | 1 | 2,825 | 23 | 5,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n... | instruction | 0 | 2,826 | 23 | 5,652 |
No | output | 1 | 2,826 | 23 | 5,653 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vec... | instruction | 0 | 3,031 | 23 | 6,062 |
Tags: brute force, geometry, math
Correct Solution:
```
n = int(input())
if n > 20:
print(0)
else:
s = []
for i in range(n):
s.append([int(i) for i in input().split()])
p = []
for i in range(n):
p.append(0)
for j in range(n):
for l in range(j):
b =... | output | 1 | 3,031 | 23 | 6,063 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vec... | instruction | 0 | 3,032 | 23 | 6,064 |
Tags: brute force, geometry, math
Correct Solution:
```
# -*- coding: utf-8 -*-
import math
import collections
import bisect
import heapq
import time
import random
import itertools
"""
created by shhuan at 2017/10/19 17:35
"""
N = int(input())
P = []
for i in range(N):
P.append([int(x) for x in input().split()])... | output | 1 | 3,032 | 23 | 6,065 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vec... | instruction | 0 | 3,033 | 23 | 6,066 |
Tags: brute force, geometry, math
Correct Solution:
```
from math import *
n = int(input())
arr = [list(map(int, input().split())) for i in range(n)]
ans = [True] * n
for a in range(n):
for b in range(n):
bad = False
for c in range(n):
if arr[b] != arr[a] and arr[c] != arr[a] and arr[b]... | output | 1 | 3,033 | 23 | 6,067 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vec... | instruction | 0 | 3,034 | 23 | 6,068 |
Tags: brute force, geometry, math
Correct Solution:
```
n = int(input())
dots = []
for i in range(n):
dots.append(list(map(int, input().split())))
good_dots = []
for a_index in range(n):
a_dot = dots[a_index]
a_is_good = True
for b_index in range(n):
for c_index in range(n):
if a_index != b_index and a_index... | output | 1 | 3,034 | 23 | 6,069 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vec... | instruction | 0 | 3,035 | 23 | 6,070 |
Tags: brute force, geometry, math
Correct Solution:
```
import sys
from math import acos, sqrt, pi
n = int(input())
p = []
def get_angle(a, b, c):
v = [(b[i]-a[i], c[i]-a[i]) for i in range(5)]
sp = sum([v[i][0]*v[i][1] for i in range(5)])
sab = sqrt(sum([v[i][0]*v[i][0] for i in range(5)]))
sac = sqrt(... | output | 1 | 3,035 | 23 | 6,071 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vec... | instruction | 0 | 3,036 | 23 | 6,072 |
Tags: brute force, geometry, math
Correct Solution:
```
import math
def check(i, j, k):
a = []
b = []
for ii in range(len(i)):
a.append(j[ii] - i[ii])
b.append(k[ii] - i[ii])
la = 0
lb = 0
scal = 0
for ii in range(len(i)):
la += a[ii] * a[ii]
lb += b[ii] * b... | output | 1 | 3,036 | 23 | 6,073 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vec... | instruction | 0 | 3,037 | 23 | 6,074 |
Tags: brute force, geometry, math
Correct Solution:
```
d = lambda i, j, k: sum((a - c) * (b - c) for a, b, c in zip(p[i], p[j], p[k])) * (i != j)
n = int(input())
r = range(n)
p = [list(map(int, input().split())) for i in r]
t = [k + 1 for k in r if all(d(i, j, k) <= 0 for i in r for j in r)] if n < 12 else []
for q i... | output | 1 | 3,037 | 23 | 6,075 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vec... | instruction | 0 | 3,038 | 23 | 6,076 |
Tags: brute force, geometry, math
Correct Solution:
```
def sc(x, y):
return x[0] * y[0] + x[1] * y[1] + x[2] * y[2] + x[3] * y[3] + x[4] * y[4]
def check(a, b, c):
if sc([b[0] - a[0], b[1] - a[1], b[2] - a[2], b[3] - a[3], b[4] - a[4]], [c[0] - a[0], c[1] - a[1], c[2] - a[2], c[3] - a[3], c[4] - a[4]]) > 0:
... | output | 1 | 3,038 | 23 | 6,077 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a,... | instruction | 0 | 3,039 | 23 | 6,078 |
Yes | output | 1 | 3,039 | 23 | 6,079 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a,... | instruction | 0 | 3,040 | 23 | 6,080 |
Yes | output | 1 | 3,040 | 23 | 6,081 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a,... | instruction | 0 | 3,041 | 23 | 6,082 |
Yes | output | 1 | 3,041 | 23 | 6,083 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a,... | instruction | 0 | 3,042 | 23 | 6,084 |
Yes | output | 1 | 3,042 | 23 | 6,085 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a,... | instruction | 0 | 3,043 | 23 | 6,086 |
No | output | 1 | 3,043 | 23 | 6,087 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a,... | instruction | 0 | 3,044 | 23 | 6,088 |
No | output | 1 | 3,044 | 23 | 6,089 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a,... | instruction | 0 | 3,045 | 23 | 6,090 |
No | output | 1 | 3,045 | 23 | 6,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a,... | instruction | 0 | 3,046 | 23 | 6,092 |
No | output | 1 | 3,046 | 23 | 6,093 |
Provide a correct Python 3 solution for this coding contest problem.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What are you making?", He replied cheerfully, "Maze !!". The m... | instruction | 0 | 3,239 | 23 | 6,478 |
"Correct Solution:
```
# Aizu Problem 0207: Block
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def build_grid(W, H, N, blocks):
grid = [[0 for _ in range(W)] for __ in range(H)]
for c, d, x, y in blocks:
x, y = x ... | output | 1 | 3,239 | 23 | 6,479 |
Provide a correct Python 3 solution for this coding contest problem.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What are you making?", He replied cheerfully, "Maze !!". The m... | instruction | 0 | 3,240 | 23 | 6,480 |
"Correct Solution:
```
# ref: https://qiita.com/masashi127/items/0c794e28f4b295ad82c6
import heapq
import itertools
def astar(init_pos, goal,dg):
passed_list = [init_pos]
init_score = distance(passed_list) + heuristic(init_pos,goal)
checked = {init_pos: init_score}
searching_heap = []
heapq.heappu... | output | 1 | 3,240 | 23 | 6,481 |
Provide a correct Python 3 solution for this coding contest problem.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What are you making?", He replied cheerfully, "Maze !!". The m... | instruction | 0 | 3,241 | 23 | 6,482 |
"Correct Solution:
```
while True:
w,h=map(int, input().split())
if w==h==0:
break
xs,ys=map(int, input().split())
xg,yg=map(int, input().split())
xs-=1
ys-=1
xg-=1
yg-=1
n=int(input())
dataset=[]
for _ in range(n):
dataset.append(list(map(int,input().split())... | output | 1 | 3,241 | 23 | 6,483 |
Provide a correct Python 3 solution for this coding contest problem.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What are you making?", He replied cheerfully, "Maze !!". The m... | instruction | 0 | 3,242 | 23 | 6,484 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0207
"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline
def solve(w, h, xs, ys, xg, yg, blocks):
# ????????????????????±????????°???????????????l
field = [[0] * (... | output | 1 | 3,242 | 23 | 6,485 |
Provide a correct Python 3 solution for this coding contest problem.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What are you making?", He replied cheerfully, "Maze !!". The m... | instruction | 0 | 3,243 | 23 | 6,486 |
"Correct Solution:
```
from collections import deque
def search(xs, ys, xg, yg, board):
direct = ((-1, 0), (1, 0), (0, -1), (0, 1))
visited = [[False] * (w + 2) for _ in range(h + 2)]
visited[ys][xs] = True
que = deque()
que.append((xs, ys))
while que:
x, y = que.popleft()
for dx, dy in direct:
... | output | 1 | 3,243 | 23 | 6,487 |
Provide a correct Python 3 solution for this coding contest problem.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What are you making?", He replied cheerfully, "Maze !!". The m... | instruction | 0 | 3,244 | 23 | 6,488 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0207
"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline
def solve(w, h, xs, ys, xg, yg, blocks):
# ????????????????????±????????°???????????????l
field = [[0] * (... | output | 1 | 3,244 | 23 | 6,489 |
Provide a correct Python 3 solution for this coding contest problem.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What are you making?", He replied cheerfully, "Maze !!". The m... | instruction | 0 | 3,245 | 23 | 6,490 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0207
"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline
def solve(w, h, xs, ys, xg, yg, blocks):
# ????????????????????±????????°???????????????l
field = [[0] * (... | output | 1 | 3,245 | 23 | 6,491 |
Provide a correct Python 3 solution for this coding contest problem.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What are you making?", He replied cheerfully, "Maze !!". The m... | instruction | 0 | 3,246 | 23 | 6,492 |
"Correct Solution:
```
""" Created by Jieyi on 9/20/16. """
def block(board, w, h, direction, color):
# horizontal.
if direction == 0:
for i in range(2):
for j in range(4):
board[h + i][w + j] = color
# vertical.
elif direction == 1:
for i in range(2):
... | output | 1 | 3,246 | 23 | 6,493 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What a... | instruction | 0 | 3,247 | 23 | 6,494 |
Yes | output | 1 | 3,247 | 23 | 6,495 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What a... | instruction | 0 | 3,248 | 23 | 6,496 |
Yes | output | 1 | 3,248 | 23 | 6,497 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What a... | instruction | 0 | 3,249 | 23 | 6,498 |
Yes | output | 1 | 3,249 | 23 | 6,499 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What a... | instruction | 0 | 3,250 | 23 | 6,500 |
Yes | output | 1 | 3,250 | 23 | 6,501 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What a... | instruction | 0 | 3,251 | 23 | 6,502 |
No | output | 1 | 3,251 | 23 | 6,503 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What a... | instruction | 0 | 3,252 | 23 | 6,504 |
No | output | 1 | 3,252 | 23 | 6,505 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What a... | instruction | 0 | 3,253 | 23 | 6,506 |
No | output | 1 | 3,253 | 23 | 6,507 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What a... | instruction | 0 | 3,254 | 23 | 6,508 |
No | output | 1 | 3,254 | 23 | 6,509 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g and target points t, print "2" if g contains t, "1" if t is on a segment of g, "0" otherwise.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the pol... | instruction | 0 | 3,297 | 23 | 6,594 |
"Correct Solution:
```
import math
class Vector:
def __init__(self,x,y):
self.x = x
self.y = y
def __add__(self,other):
return Vector(self.x+other.x,self.y+other.y)
def __sub__(self,other):
return Vector(self.x-other.x,self.y-other.y)
def __mul__(self,... | output | 1 | 3,297 | 23 | 6,595 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g and target points t, print "2" if g contains t, "1" if t is on a segment of g, "0" otherwise.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the pol... | instruction | 0 | 3,298 | 23 | 6,596 |
"Correct Solution:
```
from sys import stdin
import math
EPS = 1e-10
class Vector:
def __init__(self, x=None, y=None):
self.x = x
self.y = y
def __add__(self, other):
return Vector(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Vector(self.x - other.... | output | 1 | 3,298 | 23 | 6,597 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g and target points t, print "2" if g contains t, "1" if t is on a segment of g, "0" otherwise.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the pol... | instruction | 0 | 3,299 | 23 | 6,598 |
"Correct Solution:
```
import math
from typing import Union, Tuple
class Point(object):
__slots__ = ['x', 'y']
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, other):
return Point(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return P... | output | 1 | 3,299 | 23 | 6,599 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g and target points t, print "2" if g contains t, "1" if t is on a segment of g, "0" otherwise.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the pol... | instruction | 0 | 3,300 | 23 | 6,600 |
"Correct Solution:
```
import sys
from operator import itemgetter, attrgetter
from itertools import starmap
import cmath
from math import isinf, sqrt, acos, atan2
readline = sys.stdin.readline
EPS = 1e-9
ONLINE_FRONT = -2
CLOCKWISE = -1
ON_SEGMENT = 0
COUNTER_CLOCKWISE = 1
ONLINE_BACK = 2
class Circle(object):
__sl... | output | 1 | 3,300 | 23 | 6,601 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g and target points t, print "2" if g contains t, "1" if t is on a segment of g, "0" otherwise.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the pol... | instruction | 0 | 3,301 | 23 | 6,602 |
"Correct Solution:
```
# Aizu Problem CGL_3_C: Polygon-Point-Containment
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def cross_product_test(A, B, C):
if A[1] == B[1] == C[1]:
if B[0] <= A[0] <= C[0] or C[0] <= A[0] ... | output | 1 | 3,301 | 23 | 6,603 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g and target points t, print "2" if g contains t, "1" if t is on a segment of g, "0" otherwise.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the pol... | instruction | 0 | 3,302 | 23 | 6,604 |
"Correct Solution:
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
0 0
3 1
2 3
0 3
3
2 1
0 2
3 2
output:
2
1
0
"""
import sys
EPS = 1e-9
def cross(a, b):
return a.real * b.imag - a.imag * b.real
def dot(a, b):
return a.real * b.real + a.imag * b.imag
def check_contains(g, p):
flag =... | output | 1 | 3,302 | 23 | 6,605 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g and target points t, print "2" if g contains t, "1" if t is on a segment of g, "0" otherwise.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the pol... | instruction | 0 | 3,303 | 23 | 6,606 |
"Correct Solution:
```
#!/usr/bin/env python3
# CGL_3_C: Polygon - Polygon-Point Containment
from enum import Enum
class Position(Enum):
OUTSIDE = 0
BORDER = 1
INSIDE = 2
class Polygon:
def __init__(self, ps):
self.ps = ps
self.convex_poligons = divide(ps)
def position(self, p)... | output | 1 | 3,303 | 23 | 6,607 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g and target points t, print "2" if g contains t, "1" if t is on a segment of g, "0" otherwise.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the pol... | instruction | 0 | 3,304 | 23 | 6,608 |
"Correct Solution:
```
n = int(input())
vec = []
for i in range(n):
vec += [list(map(int, input().split()))]
vec += [vec[0]]
def cross(a, b):
return a[0]*b[1]-a[1]*b[0]
def ab(a, b):
c = (b[0]-a[0],b[1]-a[1])
return c
def dot(a, b):
n = len(a)
if n != len(b):
return None
ans = 0
... | output | 1 | 3,304 | 23 | 6,609 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given polygon g and target points t, print "2" if g contains t, "1" if t is on a segment of g, "0" otherwise.
g is represented by a sequence of points p1, p2,..., pn where line segments c... | instruction | 0 | 3,305 | 23 | 6,610 |
Yes | output | 1 | 3,305 | 23 | 6,611 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.