message stringlengths 2 19.9k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 322 108k | cluster float64 15 15 | __index_level_0__ int64 644 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.
The queen is the piece that captures all squares on its vertical, horizon... | instruction | 0 | 42,464 | 15 | 84,928 |
Yes | output | 1 | 42,464 | 15 | 84,929 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.
The queen is the piece that captures all squares on its vertical, horizon... | instruction | 0 | 42,465 | 15 | 84,930 |
Yes | output | 1 | 42,465 | 15 | 84,931 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.
The queen is the piece that captures all squares on its vertical, horizon... | instruction | 0 | 42,466 | 15 | 84,932 |
No | output | 1 | 42,466 | 15 | 84,933 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.
The queen is the piece that captures all squares on its vertical, horizon... | instruction | 0 | 42,467 | 15 | 84,934 |
No | output | 1 | 42,467 | 15 | 84,935 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.
The queen is the piece that captures all squares on its vertical, horizon... | instruction | 0 | 42,468 | 15 | 84,936 |
No | output | 1 | 42,468 | 15 | 84,937 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.
The queen is the piece that captures all squares on its vertical, horizon... | instruction | 0 | 42,469 | 15 | 84,938 |
No | output | 1 | 42,469 | 15 | 84,939 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Peppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of n rows and m columns. We enumerate the rows of the rectan... | instruction | 0 | 42,502 | 15 | 85,004 |
No | output | 1 | 42,502 | 15 | 85,005 |
Provide a correct Python 3 solution for this coding contest problem.
C --Dowsing Machine
Story
People make noise with X and Y, but the coming era will be "D". "Paklin Monster D" is a very popular game in which "D people" search for treasure using the "D machine" developed by the secret society "R team".
In this gam... | instruction | 0 | 42,855 | 15 | 85,710 |
"Correct Solution:
```
def bfs(start_y,start_x,goal_y,goal_x):
bfs_map = [[-1 for x in range(w)] for y in range(h)]
move_y = [1,-1,0,0]
move_x = [0,0,1,-1]
data_y = [start_y]
data_x = [start_x]
bfs_map[start_y][start_x] = 1
while len(data_x) != 0:
y = data_y.pop(0)
x = data_x... | output | 1 | 42,855 | 15 | 85,711 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
C --Dowsing Machine
Story
People make noise with X and Y, but the coming era will be "D". "Paklin Monster D" is a very popular game in which "D people" search for treasure using the "D machine... | instruction | 0 | 42,856 | 15 | 85,712 |
No | output | 1 | 42,856 | 15 | 85,713 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
C --Dowsing Machine
Story
People make noise with X and Y, but the coming era will be "D". "Paklin Monster D" is a very popular game in which "D people" search for treasure using the "D machine... | instruction | 0 | 42,857 | 15 | 85,714 |
No | output | 1 | 42,857 | 15 | 85,715 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.
Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on... | instruction | 0 | 43,172 | 15 | 86,344 |
Tags: constructive algorithms, math
Correct Solution:
```
import math
import bisect
from collections import defaultdict
from collections import OrderedDict
for _ in range(int(input())):
#n,k = map(int,input().split())
n = int(input())
mat = []
for i in range(n):
tmp = list(input())
... | output | 1 | 43,172 | 15 | 86,345 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.
Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on... | instruction | 0 | 43,173 | 15 | 86,346 |
Tags: constructive algorithms, math
Correct Solution:
```
from sys import stdin as inp
from sys import stdout as out
import math
for _ in range(int(inp.readline())):
n=int(inp.readline())
matrix=[list(inp.readline()) for _ in range(n)]
check=[0,0,0]
for i in range(n):
for j in range(n):
... | output | 1 | 43,173 | 15 | 86,347 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.
Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on... | instruction | 0 | 43,174 | 15 | 86,348 |
Tags: constructive algorithms, math
Correct Solution:
```
# Enter your code here. Read input from STDIN. Print output to STDOUT# ===============================================================================================
# importing some useful libraries.
from __future__ import division, print_function
from fractio... | output | 1 | 43,174 | 15 | 86,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.
Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on... | instruction | 0 | 43,175 | 15 | 86,350 |
Tags: constructive algorithms, math
Correct Solution:
```
t = int(input())
for case in range(t):
n = int(input())
grid = []
for row in range(n):
grid.append(list(input()))
m = float('inf')
s = 0
for k in range(3):
c = 0
for i in range(n):
for j in range(n):
... | output | 1 | 43,175 | 15 | 86,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.
Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on... | instruction | 0 | 43,176 | 15 | 86,352 |
Tags: constructive algorithms, math
Correct Solution:
```
for _ in range(int(input())):
a=[]
n=int(input())
for i in range(n):
a.append(list(str(input())))
c=[0]*3
for i in range(n):
for j in range(n):
if (i+j)%3==0 and a[i][j]=="X":
c[0]+=1
el... | output | 1 | 43,176 | 15 | 86,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.
Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on... | instruction | 0 | 43,177 | 15 | 86,354 |
Tags: constructive algorithms, math
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
for _ in range(int(input())):
n = int(input())
a = []
for i in range(n):
a.append(list(input()))
b=[]
for i in range(n):
b.append([])
for j in range(n):
... | output | 1 | 43,177 | 15 | 86,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.
Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on... | instruction | 0 | 43,178 | 15 | 86,356 |
Tags: constructive algorithms, math
Correct Solution:
```
t=int(input())
for i in range(t):
n=int(input())
a=[]
for j in range(n):
a.append([])
b=input()
for k in range(n):
a[j].append(b[k])
c=n**2
d=0
for l in range(3):
o=0
f=a
for j i... | output | 1 | 43,178 | 15 | 86,357 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.
Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on... | instruction | 0 | 43,179 | 15 | 86,358 |
Tags: constructive algorithms, math
Correct Solution:
```
import sys
input = sys.stdin.readline
import math
for _ in range(int(input())):
n = int(input())
arr = []
for i in range(n):
temp = input().rstrip()
arr.append([])
for c in temp:
arr[i].append(c)
diag1 = diag2... | output | 1 | 43,179 | 15 | 86,359 |
Provide a correct Python 3 solution for this coding contest problem.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Currently the two are in a department store and are in differen... | instruction | 0 | 43,717 | 15 | 87,434 |
"Correct Solution:
```
from collections import deque
dd = ((-1, 0), (0, -1), (1, 0), (0, 1))
DD = [-1, 1]
while 1:
W, H = map(int, input().split())
if W == H == 0:
break
tx, ty = map(int, input().split())
kx, ky = map(int, input().split())
D = [list(map(int, input().split())) for i in range... | output | 1 | 43,717 | 15 | 87,435 |
Provide a correct Python 3 solution for this coding contest problem.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Currently the two are in a department store and are in differen... | instruction | 0 | 43,718 | 15 | 87,436 |
"Correct Solution:
```
# from line_profiler import LineProfiler
from collections import deque
def main():
while(True):
W, H = map(int, input().split())
if not W: break
tx,ty = map(int, input().split())
kx,ky = map(int, input().split())
ma = [[False]*(W+2) for _ in range(H+2)... | output | 1 | 43,718 | 15 | 87,437 |
Provide a correct Python 3 solution for this coding contest problem.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Currently the two are in a department store and are in differen... | instruction | 0 | 43,719 | 15 | 87,438 |
"Correct Solution:
```
# from line_profiler import LineProfiler
from collections import deque
from sys import stdin
def main():
while(True):
W, H = map(int, stdin.readline().split())
if not W: break
tx,ty = map(int, stdin.readline().split())
kx,ky = map(int, stdin.readline().split()... | output | 1 | 43,719 | 15 | 87,439 |
Provide a correct Python 3 solution for this coding contest problem.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Currently the two are in a department store and are in differen... | instruction | 0 | 43,720 | 15 | 87,440 |
"Correct Solution:
```
# from line_profiler import LineProfiler
from collections import deque
from sys import stdin
def main():
while(True):
W, H = map(int, stdin.readline().split())
if not W: break
tx,ty = map(int, stdin.readline().split())
kx,ky = map(int, stdin.readline().split()... | output | 1 | 43,720 | 15 | 87,441 |
Provide a correct Python 3 solution for this coding contest problem.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Currently the two are in a department store and are in differen... | instruction | 0 | 43,721 | 15 | 87,442 |
"Correct Solution:
```
from collections import deque
def bfs(tx,ty,kx,ky,d):
dict = {}
que = deque([(tx,ty,kx,ky,0)])
while len(que):
tx,ty,kx,ky,t = que.popleft()
try:
if dict[(tx,ty,kx,ky)] <= t:
continue
except KeyError:
dict[(tx,ty,kx,... | output | 1 | 43,721 | 15 | 87,443 |
Provide a correct Python 3 solution for this coding contest problem.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Currently the two are in a department store and are in differen... | instruction | 0 | 43,722 | 15 | 87,444 |
"Correct Solution:
```
# from line_profiler import LineProfiler
from collections import deque
def main():
while(True):
W, H = map(int, input().split())
if not W: break
tx,ty = map(int, input().split())
kx,ky = map(int, input().split())
ma = [[False]*(W+2) for _ in range(H+2)... | output | 1 | 43,722 | 15 | 87,445 |
Provide a correct Python 3 solution for this coding contest problem.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Currently the two are in a department store and are in differen... | instruction | 0 | 43,723 | 15 | 87,446 |
"Correct Solution:
```
# from line_profiler import LineProfiler
from collections import deque
from sys import stdin
def main():
while(True):
W, H = map(int, stdin.readline().split())
if not W: break
tx,ty = map(int, stdin.readline().split())
kx,ky = map(int, stdin.readline().split()... | output | 1 | 43,723 | 15 | 87,447 |
Provide a correct Python 3 solution for this coding contest problem.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Currently the two are in a department store and are in differen... | instruction | 0 | 43,724 | 15 | 87,448 |
"Correct Solution:
```
# from line_profiler import LineProfiler
from collections import deque
from sys import stdin
def main():
while(True):
W, H = map(int, stdin.readline().split())
if not W: break
tx,ty = map(int, stdin.readline().split())
kx,ky = map(int, stdin.readline().split()... | output | 1 | 43,724 | 15 | 87,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Current... | instruction | 0 | 43,725 | 15 | 87,450 |
Yes | output | 1 | 43,725 | 15 | 87,451 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Current... | instruction | 0 | 43,726 | 15 | 87,452 |
Yes | output | 1 | 43,726 | 15 | 87,453 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Current... | instruction | 0 | 43,727 | 15 | 87,454 |
Yes | output | 1 | 43,727 | 15 | 87,455 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Current... | instruction | 0 | 43,728 | 15 | 87,456 |
Yes | output | 1 | 43,728 | 15 | 87,457 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Current... | instruction | 0 | 43,729 | 15 | 87,458 |
No | output | 1 | 43,729 | 15 | 87,459 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Current... | instruction | 0 | 43,730 | 15 | 87,460 |
No | output | 1 | 43,730 | 15 | 87,461 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Current... | instruction | 0 | 43,731 | 15 | 87,462 |
No | output | 1 | 43,731 | 15 | 87,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Current... | instruction | 0 | 43,732 | 15 | 87,464 |
No | output | 1 | 43,732 | 15 | 87,465 |
Provide a correct Python 3 solution for this coding contest problem.
Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal s... | instruction | 0 | 43,733 | 15 | 87,466 |
"Correct Solution:
```
# AOJ 1156: Twirling Robot
# Python3 2018.7.15 bal4u
mv = [[-1,0,],[0,1],[1,0],[0,-1]]
INF = 0x7fffffff
import heapq
def dijkstra(h, w, cost):
Q = []
node = [[[INF for d in range(4)] for c in range(w)] for r in range(h)]
node[0][0][1] = 0
heapq.heappush(Q, (0, 0, 0, 1))
while Q:
t, r, c,... | output | 1 | 43,733 | 15 | 87,467 |
Provide a correct Python 3 solution for this coding contest problem.
Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal s... | instruction | 0 | 43,734 | 15 | 87,468 |
"Correct Solution:
```
import sys
from collections import deque
input = sys.stdin.readline
def main():
while True:
w, h = map(int, input().split())
if w == 0:
break
board = [list(map(int, input().split())) for i in range(h)]
tmp = list(map(int, input().split()))
... | output | 1 | 43,734 | 15 | 87,469 |
Provide a correct Python 3 solution for this coding contest problem.
Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal s... | instruction | 0 | 43,735 | 15 | 87,470 |
"Correct Solution:
```
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().... | output | 1 | 43,735 | 15 | 87,471 |
Provide a correct Python 3 solution for this coding contest problem.
Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal s... | instruction | 0 | 43,736 | 15 | 87,472 |
"Correct Solution:
```
import heapq
def main():
w,h = 0,0
grid = []
c = []
inf = 1000000007
y = [0,1,0,-1]
x = [1,0,-1,0]
def inside(i,j):
return 0<=i and i<h and 0<=j and j<w
def solve():
d = [[[inf]*4 for _ in range(w)] for _ in range(h)]
d[0][0][0] = 0
... | output | 1 | 43,736 | 15 | 87,473 |
Provide a correct Python 3 solution for this coding contest problem.
Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal s... | instruction | 0 | 43,737 | 15 | 87,474 |
"Correct Solution:
```
import sys
from collections import deque
from heapq import heappush,heappop
d = [(0,1),(1,0),(0,-1),(-1,0)]
def bfs():
dist = [[[float("inf")]*4 for i in range(w)] for j in range(h)]
dist[0][0][0] = 0
q = [(0,0,0,0)]
while q:
dn,y,x,c = heappop(q)
for di in range(... | output | 1 | 43,737 | 15 | 87,475 |
Provide a correct Python 3 solution for this coding contest problem.
Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal s... | instruction | 0 | 43,738 | 15 | 87,476 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int... | output | 1 | 43,738 | 15 | 87,477 |
Provide a correct Python 3 solution for this coding contest problem.
Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal s... | instruction | 0 | 43,739 | 15 | 87,478 |
"Correct Solution:
```
from heapq import heappop, heappush
def inpl(): return list(map(int, input().split()))
W, H = inpl()
INF = 10**6
while W:
S = [[5]*(W+2)]
for _ in range(H):
S.append([5] + inpl() + [5])
S.append([5]*(W+2))
C = inpl()
D = [[0, -1], [1, 0], [0, 1], [-1, 0]]
E = [[[... | output | 1 | 43,739 | 15 | 87,479 |
Provide a correct Python 3 solution for this coding contest problem.
Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal s... | instruction | 0 | 43,740 | 15 | 87,480 |
"Correct Solution:
```
from heapq import heappop, heappush
def main():
R, D, L, U = 0, 1, 2, 3
vector = ((1, 0), (0, 1), (-1, 0), (0, -1))
while True:
w, h = map(int, input().split())
if w == 0:
break
mp = [[5] + list(map(int, input().split())) + [5] for _ in range(h)]
mp.insert(0, [5] *... | output | 1 | 43,740 | 15 | 87,481 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (r, c) which means th... | instruction | 0 | 43,879 | 15 | 87,758 |
Tags: greedy, sortings
Correct Solution:
```
n, m = map(int, input().split())
a = [(s.find("W"), s.rfind("W")) for s in [input() for i in range(n)]]
steps = n-1
prev = 0
tr = True
while steps > 0 and a[steps][0] == -1:
steps -= 1
for i, j in a[:steps+1]:
if i != -1:
if tr == True:
steps += abs(i-prev)+j... | output | 1 | 43,879 | 15 | 87,759 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (r, c) which means th... | instruction | 0 | 43,880 | 15 | 87,760 |
Tags: greedy, sortings
Correct Solution:
```
# Patrick Inglesby
# 3/18/2019
# CODEFORCES 115B - Lawnmower
# Things to learn from this:
# - Take an array of points from input (cool kid)
# take our size of array
n, m = [int(x) for x in input().split()]
# this gives us an array of the location of the first and last weed... | output | 1 | 43,880 | 15 | 87,761 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (r, c) which means th... | instruction | 0 | 43,881 | 15 | 87,762 |
Tags: greedy, sortings
Correct Solution:
```
n, m = map(int, input().split())
s = []
for i in range(n):
s.append(input())
pos = [(ss.find('W'), ss.rfind('W')) for ss in s]
ans, cur, last, goright = 0, 0, n - 1, True
while last > 0 and pos[last][0] == -1:
last = last - 1
ans = last
for lm, rm in pos[0 : last + 1]:
... | output | 1 | 43,881 | 15 | 87,763 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (r, c) which means th... | instruction | 0 | 43,882 | 15 | 87,764 |
Tags: greedy, sortings
Correct Solution:
```
n, m = map(int, input().split())
s = []
for i in range(n):
s.append(input())
pos = [(ss.find('W'), ss.rfind('W')) for ss in s]
ans, cur, last, goright = 0, 0, n - 1, True #no type bitch!
while last > 0 and pos[last][0] == -1:
last = last - 1
ans = last
for lm, rm in pos[0... | output | 1 | 43,882 | 15 | 87,765 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (r, c) which means th... | instruction | 0 | 43,883 | 15 | 87,766 |
Tags: greedy, sortings
Correct Solution:
```
n, m = map(int, input().split())
t = [(p.find('W'), p.rfind('W')) for p in [input() for i in range(n)]]
c, s, k = 0, n - 1, True
while s > 0 and t[s][0] == -1:
s -= 1
for a, b in t[: s + 1]:
if a != -1:
if k:
s += abs(a - c) + b - a
c ... | output | 1 | 43,883 | 15 | 87,767 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (r, c) which means th... | instruction | 0 | 43,884 | 15 | 87,768 |
Tags: greedy, sortings
Correct Solution:
```
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = fil... | output | 1 | 43,884 | 15 | 87,769 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (r, c) which means th... | instruction | 0 | 43,885 | 15 | 87,770 |
Tags: greedy, sortings
Correct Solution:
```
rc=input().split()
r=int(rc[0])
c=int(rc[1])
l=[]
for i in range(r):
l.append([i for i in input()])
pos=[0,0]
last=[0,0]
count=0
for i in range(r-1):
j=pos[1]
while j>=0 and j<c:
if l[i][j]=="W":
count+=abs(j-pos[1])
pos[1]=j
... | output | 1 | 43,885 | 15 | 87,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (r, c) which means th... | instruction | 0 | 43,886 | 15 | 87,772 |
Tags: greedy, sortings
Correct Solution:
```
m,n=map(int,input().split())
arr=[]
s=[]
e=[]
t=[]
move=0
row=0
cur=0
for i in range(m):
a=input()
arr.append(a)
for i in range(m):
if 'W' in arr[i]:
s.append(arr[i].find('W'))
e.append(arr[i].rfind('W'))
t.append(i%2)
row=i
for i ... | output | 1 | 43,886 | 15 | 87,773 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.