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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Have you ever heard of the unit "○○ tsubo" that expresses the area of land? Since ancient times, one samurai has said the area for making rice to eat in a day.
There is a land of a [m] x b [m... | instruction | 0 | 14,939 | 23 | 29,878 |
No | output | 1 | 14,939 | 23 | 29,879 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk from a square land area to another if they are horizontall... | instruction | 0 | 14,981 | 23 | 29,962 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(2500)
def erase(x, y):
c[y][x] = '0'
for dx, dy in ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)):
nx, ny = x + dx, y + dy
if 0 <= nx < w and 0 <= ny < h and c[ny][nx] == '1':
erase(nx, ny)
while True... | output | 1 | 14,981 | 23 | 29,963 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk from a square land area to another if they are horizontall... | instruction | 0 | 14,982 | 23 | 29,964 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10 ** 7)
def dfs(y, x):
if not (0 <= y < h) or not (0 <= x < w) or not L[y][x]:
return
else:
L[y][x] = 0
dy = [1, 1, 1, 0, 0, -1, -1, -1]
dx = [-1, 0, 1, -1, 1, -1, 0, 1]
for i in range(8):
ny = y + dy[i]
... | output | 1 | 14,982 | 23 | 29,965 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk from a square land area to another if they are horizontall... | instruction | 0 | 14,983 | 23 | 29,966 |
"Correct Solution:
```
# 25
import sys
import itertools
sys.setrecursionlimit(10**7) #再帰関数の呼び出し制限
while True:
w, h = map(int, input().split())
if w == 0 and h == 0:
break
c_l = [[int(x) for x in input().split()] for y in range(h)]
s_l = [[True] * w for x in range(h)]
v_l = list(itertools.p... | output | 1 | 14,983 | 23 | 29,967 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk from a square land area to another if they are horizontall... | instruction | 0 | 14,984 | 23 | 29,968 |
"Correct Solution:
```
from collections import deque
while True:
w,h=map(int,input().split())
if w==0 and h==0:
exit()
field=[input().split() for i in range(h)]
option=deque()
for i in range(h):
for j in range(w):
if field[i][j]=="1":
option.append([i... | output | 1 | 14,984 | 23 | 29,969 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk from a square land area to another if they are horizontall... | instruction | 0 | 14,985 | 23 | 29,970 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(200000)
readline = sys.stdin.buffer.readline
def dfs(C, h, w):
# 一度訪ねた陸地は'0'(海)に置き換える
C[h][w] = '0'
for i in range(-1, 2):
for j in range(-1, 2):
if 0 <= h+i < len(C) and 0 <= w+j < len(C[0]) and C[h+i][w+j] == '1':
... | output | 1 | 14,985 | 23 | 29,971 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk from a square land area to another if they are horizontall... | instruction | 0 | 14,986 | 23 | 29,972 |
"Correct Solution:
```
def solve():
from sys import stdin, setrecursionlimit
setrecursionlimit(4000)
f_i = stdin
def dfs(pos):
area_map[pos] = '0'
for mv in move:
next_pos = pos + mv
if area_map[next_pos] == '1':
dfs(next_pos)
while T... | output | 1 | 14,986 | 23 | 29,973 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk from a square land area to another if they are horizontall... | instruction | 0 | 14,987 | 23 | 29,974 |
"Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().rstrip()
def resolve():
while True:
w, h = map(int, input().split())
if w==h==0:
break
c = [list(map(int, input().split())) for _ in range(h)]
stk = []
visited = [[False]*w for _ in range(h)... | output | 1 | 14,987 | 23 | 29,975 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk from a square land area to another if they are horizontall... | instruction | 0 | 14,988 | 23 | 29,976 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10 ** 7)
def dfs(h, w, grid):
grid[h][w] = 0
# 八方向を探索
for dh in range(-1, 2):
for dw in range(-1, 2):
nh = dh + h
nw = dw + w
# 場外だった場合はするー(番兵)
if nh < 0 or nw < 0:
continue
... | output | 1 | 14,988 | 23 | 29,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk fr... | instruction | 0 | 14,989 | 23 | 29,978 |
Yes | output | 1 | 14,989 | 23 | 29,979 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk fr... | instruction | 0 | 14,990 | 23 | 29,980 |
Yes | output | 1 | 14,990 | 23 | 29,981 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk fr... | instruction | 0 | 14,991 | 23 | 29,982 |
Yes | output | 1 | 14,991 | 23 | 29,983 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk fr... | instruction | 0 | 14,992 | 23 | 29,984 |
Yes | output | 1 | 14,992 | 23 | 29,985 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk fr... | instruction | 0 | 14,993 | 23 | 29,986 |
No | output | 1 | 14,993 | 23 | 29,987 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk fr... | instruction | 0 | 14,994 | 23 | 29,988 |
No | output | 1 | 14,994 | 23 | 29,989 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk fr... | instruction | 0 | 14,995 | 23 | 29,990 |
No | output | 1 | 14,995 | 23 | 29,991 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.
<image>
Figure B-1: A marine area map
You can walk fr... | instruction | 0 | 14,996 | 23 | 29,992 |
No | output | 1 | 14,996 | 23 | 29,993 |
Provide a correct Python 3 solution for this coding contest problem.
The configuration of three circles packed inside a triangle such that each circle is tangent to the other two circles and to two of the edges of the triangle has been studied by many mathematicians for more than two centuries. Existence and uniquenes... | instruction | 0 | 14,997 | 23 | 29,994 |
"Correct Solution:
```
from functools import reduce
import math
def length(p1, p2):
sub2 = [(a - b)**2 for a, b in zip(p1, p2)]
return math.sqrt(sum(sub2))
def r_center(lines):
lines_sum = reduce(lambda a, b: a + b, lines)
s = lines_sum / 2
area = math.sqrt(s * (s - lines[0]) * (s - lines[1]) * ... | output | 1 | 14,997 | 23 | 29,995 |
Provide a correct Python 3 solution for this coding contest problem.
The configuration of three circles packed inside a triangle such that each circle is tangent to the other two circles and to two of the edges of the triangle has been studied by many mathematicians for more than two centuries. Existence and uniquenes... | instruction | 0 | 14,998 | 23 | 29,996 |
"Correct Solution:
```
def solve():
from sys import stdin
file_input = stdin
while True:
x1, y1, x2, y2, x3, y3 = map(int, file_input.readline().split())
if x1 == y1 == x2 == y2 == 0:
break
A = x1 + y1 * 1j
B = x2 + y2 * 1j
C = x3 + y3 * 1j
... | output | 1 | 14,998 | 23 | 29,997 |
Provide a correct Python 3 solution for this coding contest problem.
The configuration of three circles packed inside a triangle such that each circle is tangent to the other two circles and to two of the edges of the triangle has been studied by many mathematicians for more than two centuries. Existence and uniquenes... | instruction | 0 | 14,999 | 23 | 29,998 |
"Correct Solution:
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Problems 1301
Problem G: Malfatti Circles
"""
import math
def main():
while True:
x1, y1, x2, y2, x3, y3 = map(int,input().split())
if x1 == y1 == x2 == y2 == x3 == y3 == 0:
break
a = math.sqrt( (x... | output | 1 | 14,999 | 23 | 29,999 |
Provide a correct Python 3 solution for this coding contest problem.
The configuration of three circles packed inside a triangle such that each circle is tangent to the other two circles and to two of the edges of the triangle has been studied by many mathematicians for more than two centuries. Existence and uniquenes... | instruction | 0 | 15,000 | 23 | 30,000 |
"Correct Solution:
```
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
x1, y1, x2, y2, x3, y3 = map(int, readline().split())
if x1 == y1 == x2 == y2 == x3 == y3 == 0:
return False
d12 = ((x1-x2)**2 + (y1-y2)**2)**.5
d23 = ((x2-x3)**2 + (y2-y3)**2)**.5
d31 = ((x... | output | 1 | 15,000 | 23 | 30,001 |
Provide a correct Python 3 solution for this coding contest problem.
The configuration of three circles packed inside a triangle such that each circle is tangent to the other two circles and to two of the edges of the triangle has been studied by many mathematicians for more than two centuries. Existence and uniquenes... | instruction | 0 | 15,001 | 23 | 30,002 |
"Correct Solution:
```
import math
def length(x1, y1, x2, y2):
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
while True:
p = list(map(int, input().split()))
if not list(filter(lambda x: x, p)):
break
a, b, c = length(p[0], p[1], p[2], p[3]), length(p[0], p[1], p[4], p[5]), length(p[2], p[3]... | output | 1 | 15,001 | 23 | 30,003 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ujan has finally cleaned up his house and now wants to decorate the interior. He decided to place a beautiful carpet that would really tie the guest room together.
He is interested in carpets t... | instruction | 0 | 15,180 | 23 | 30,360 |
No | output | 1 | 15,180 | 23 | 30,361 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments [l_1, r_1], [l_2, r_2], ..., [l_n, r_n]. Each segment has one of two colors: the i-th segment's color is t_i.
Let's call a pair of segments i and j bad if the following... | instruction | 0 | 15,248 | 23 | 30,496 |
No | output | 1 | 15,248 | 23 | 30,497 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments [l_1, r_1], [l_2, r_2], ..., [l_n, r_n]. Each segment has one of two colors: the i-th segment's color is t_i.
Let's call a pair of segments i and j bad if the following... | instruction | 0 | 15,249 | 23 | 30,498 |
No | output | 1 | 15,249 | 23 | 30,499 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments [l_1, r_1], [l_2, r_2], ..., [l_n, r_n]. Each segment has one of two colors: the i-th segment's color is t_i.
Let's call a pair of segments i and j bad if the following... | instruction | 0 | 15,250 | 23 | 30,500 |
No | output | 1 | 15,250 | 23 | 30,501 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments [l_1, r_1], [l_2, r_2], ..., [l_n, r_n]. Each segment has one of two colors: the i-th segment's color is t_i.
Let's call a pair of segments i and j bad if the following... | instruction | 0 | 15,251 | 23 | 30,502 |
No | output | 1 | 15,251 | 23 | 30,503 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of... | instruction | 0 | 15,573 | 23 | 31,146 |
Tags: implementation
Correct Solution:
```
m, n=[int(i) for i in input().split()]
started=False
failed=False
finished=False
t=[-5, -5]
blank="."*n
for i in range(m):
s=input()
# print(t, finished, started, failed, s)
if "X" in s:
if finished:
failed=True
break
if not started:
started=True... | output | 1 | 15,573 | 23 | 31,147 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of... | instruction | 0 | 15,574 | 23 | 31,148 |
Tags: implementation
Correct Solution:
```
n, m = map(int, input().split())
a = [input() for i in range(n)]
minx = m
miny = n
maxx = -1
maxy = -1
for i in range(n):
for j in range(m):
if a[i][j] == 'X':
if i > maxy:
maxy = i
if i < miny:
miny = i
... | output | 1 | 15,574 | 23 | 31,149 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of... | instruction | 0 | 15,575 | 23 | 31,150 |
Tags: implementation
Correct Solution:
```
#!/usr/bin/env python3
from sys import stdin,stdout
def ri():
return map(int, input().split())
n, m = ri()
found = 0
for i in range(n):
r = input()
if found == 0 and 'X' in r:
r0 = r
found = 1
continue
if found and 'X' in r:
i... | output | 1 | 15,575 | 23 | 31,151 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of... | instruction | 0 | 15,576 | 23 | 31,152 |
Tags: implementation
Correct Solution:
```
n, m = map(int, input().split())
ss = ""
for i in range(n):
s = str(input())
if 'X' in s:
if ss == "":
ss = s
else:
if s == ss:
pass
else:
print("NO")
exit()
print("Y... | output | 1 | 15,576 | 23 | 31,153 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of... | instruction | 0 | 15,577 | 23 | 31,154 |
Tags: implementation
Correct Solution:
```
def fail():
print('NO')
exit()
read = lambda: map(int, input().split())
n, m = read()
a = [input() for i in range(n)]
fst = None
for i in range(n):
for j in range(m):
if a[i][j] == 'X':
fst = i, j
break
if fst != None:
b... | output | 1 | 15,577 | 23 | 31,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of... | instruction | 0 | 15,578 | 23 | 31,156 |
Tags: implementation
Correct Solution:
```
import sys
n, m = map(int, input().split())
a = [input() for _ in range(n)]
min_i, min_j = n, m
max_i, max_j = 0, 0
for i in range(n):
for j in range(m):
if a[i][j] == 'X':
min_i, min_j = min(min_i, i), min(min_j, j)
max_i, max_j = max(ma... | output | 1 | 15,578 | 23 | 31,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of... | instruction | 0 | 15,579 | 23 | 31,158 |
Tags: implementation
Correct Solution:
```
n, m = [int(i) for i in input().split()]
pattern_dict = dict()
pattern_0 = '.'*m
no_flag = False
for i in range(n):
s = input()
position = [j for j in range(m) if s[j]=='X']
if s != pattern_0:
if s not in pattern_dict:
pattern_dict[s] = [i]
... | output | 1 | 15,579 | 23 | 31,159 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of... | instruction | 0 | 15,580 | 23 | 31,160 |
Tags: implementation
Correct Solution:
```
n, m = map(int, input().split())
a = []
for i in range(n):
a.append(input())
inf = 10 ** 9
p, q = inf, inf
r, s = -1, -1
for i in range(n):
for j in range(m):
if a[i][j] == 'X':
p = min(p, i)
q = min(q, j)
r = max(r, i)
... | output | 1 | 15,580 | 23 | 31,161 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of charac... | instruction | 0 | 15,581 | 23 | 31,162 |
Yes | output | 1 | 15,581 | 23 | 31,163 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of charac... | instruction | 0 | 15,582 | 23 | 31,164 |
Yes | output | 1 | 15,582 | 23 | 31,165 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of charac... | instruction | 0 | 15,583 | 23 | 31,166 |
Yes | output | 1 | 15,583 | 23 | 31,167 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of charac... | instruction | 0 | 15,584 | 23 | 31,168 |
Yes | output | 1 | 15,584 | 23 | 31,169 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of charac... | instruction | 0 | 15,585 | 23 | 31,170 |
No | output | 1 | 15,585 | 23 | 31,171 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of charac... | instruction | 0 | 15,586 | 23 | 31,172 |
No | output | 1 | 15,586 | 23 | 31,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of charac... | instruction | 0 | 15,587 | 23 | 31,174 |
No | output | 1 | 15,587 | 23 | 31,175 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow likes solving puzzles.
One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of charac... | instruction | 0 | 15,588 | 23 | 31,176 |
No | output | 1 | 15,588 | 23 | 31,177 |
Provide a correct Python 3 solution for this coding contest problem.
Consider placing N flags on a line. Flags are numbered through 1 to N.
Flag i can be placed on the coordinate X_i or Y_i. For any two different flags, the distance between them should be at least D.
Decide whether it is possible to place all N flag... | instruction | 0 | 15,699 | 23 | 31,398 |
"Correct Solution:
```
from collections import defaultdict
class TwoSat:
def __init__(self, V):
self.N = len(V)
self.ans = None
self.__e = []
self.__v = V
def add_clause(self, i, f, j, g):
self.__e.append((2*i + (0 if f else 1), 2*j + (1 if g else 0)))
self.__e... | output | 1 | 15,699 | 23 | 31,399 |
Provide a correct Python 3 solution for this coding contest problem.
Consider placing N flags on a line. Flags are numbered through 1 to N.
Flag i can be placed on the coordinate X_i or Y_i. For any two different flags, the distance between them should be at least D.
Decide whether it is possible to place all N flag... | instruction | 0 | 15,700 | 23 | 31,400 |
"Correct Solution:
```
class CSR:
def __init__(self, n: int, edges: list):
self.start = [0] * (n + 1)
self.elist = [0] * len(edges)
for e in edges:
self.start[e[0] + 1] += 1
for i in range(1, n + 1):
self.start[i] += self.start[i - 1]
counter = self.... | output | 1 | 15,700 | 23 | 31,401 |
Provide a correct Python 3 solution for this coding contest problem.
Consider placing N flags on a line. Flags are numbered through 1 to N.
Flag i can be placed on the coordinate X_i or Y_i. For any two different flags, the distance between them should be at least D.
Decide whether it is possible to place all N flag... | instruction | 0 | 15,701 | 23 | 31,402 |
"Correct Solution:
```
#-------最強ライブラリ2-SAT(Python)------
#最強ライブラリSCC(Python)が必要
class two_sat:
def __init__(s):
s._n = 0
s.scc = scc_graph(0)
def __init__(s, n):
s._n = n
s._answer = [False] * n
s.scc = scc_graph(2 * n)
# クローズを足す
# クローズってなに
def add_clause(s, i, f, j, g):
s.scc.add_e... | output | 1 | 15,701 | 23 | 31,403 |
Provide a correct Python 3 solution for this coding contest problem.
Consider placing N flags on a line. Flags are numbered through 1 to N.
Flag i can be placed on the coordinate X_i or Y_i. For any two different flags, the distance between them should be at least D.
Decide whether it is possible to place all N flag... | instruction | 0 | 15,702 | 23 | 31,404 |
"Correct Solution:
```
from itertools import product
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 6 + 100)
class StronglyConnectedComponets:
def __init__(self, n: int) -> None:
self.n = n
self.edges = [[] for _ in range(n)]
self.rev_edeges = [[] for _ in range(... | output | 1 | 15,702 | 23 | 31,405 |
Provide a correct Python 3 solution for this coding contest problem.
Consider placing N flags on a line. Flags are numbered through 1 to N.
Flag i can be placed on the coordinate X_i or Y_i. For any two different flags, the distance between them should be at least D.
Decide whether it is possible to place all N flag... | instruction | 0 | 15,703 | 23 | 31,406 |
"Correct Solution:
```
# AC Library Python版
# Author Koki_tkg
'''
internal_type_traits以外は翻訳しました。
practiceは一応全部ACしていますが,
practiceで使っていない関数などの動作は未確認なので保証はしません。
また,C++版をほぼそのまま書き換えているので速度は出ません。 (2020/09/13 by Koki_tkg)
'''
# --------------------<< Library Start >>-------------------- #
# convolution.py
class convolution:... | output | 1 | 15,703 | 23 | 31,407 |
Provide a correct Python 3 solution for this coding contest problem.
Consider placing N flags on a line. Flags are numbered through 1 to N.
Flag i can be placed on the coordinate X_i or Y_i. For any two different flags, the distance between them should be at least D.
Decide whether it is possible to place all N flag... | instruction | 0 | 15,704 | 23 | 31,408 |
"Correct Solution:
```
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
# Strongly connected component
# derived from https://atcoder.jp/contests/practice2/submissions/16645774
def get_strongly_connected_components(edges, num_vertex):
... | output | 1 | 15,704 | 23 | 31,409 |
Provide a correct Python 3 solution for this coding contest problem.
Consider placing N flags on a line. Flags are numbered through 1 to N.
Flag i can be placed on the coordinate X_i or Y_i. For any two different flags, the distance between them should be at least D.
Decide whether it is possible to place all N flag... | instruction | 0 | 15,705 | 23 | 31,410 |
"Correct Solution:
```
from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys
sys.setrecursionlimit(10**6)
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sy... | output | 1 | 15,705 | 23 | 31,411 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.