message stringlengths 2 22.8k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 16 109k | cluster float64 1 1 | __index_level_0__ int64 32 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he can move in a unit distance in horizontal or ve... | instruction | 0 | 32,061 | 1 | 64,122 |
Tags: math
Correct Solution:
```
a, b, s = map(lambda x: abs(int(x)), input().split())
print("Yes" if a + b == s or (a + b < s and (s - (a + b)) % 2 == 0) else "No")
``` | output | 1 | 32,061 | 1 | 64,123 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he can move in a unit distance in horizontal or ve... | instruction | 0 | 32,062 | 1 | 64,124 |
Tags: math
Correct Solution:
```
a, b, s = map(int, input().split())
if(abs(a)+abs(b)>s):
print("No")
else:
if(abs(a)+abs(b)-s)%2==0:
print("Yes")
else:
print("No")
``` | output | 1 | 32,062 | 1 | 64,125 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he can move in a unit distance in horizontal or ve... | instruction | 0 | 32,063 | 1 | 64,126 |
Tags: math
Correct Solution:
```
a,b,s=map(int,input().split())
s-=abs(a)+abs(b)
if s%2==1 or s<0:
print("No")
else:
print("Yes")
``` | output | 1 | 32,063 | 1 | 64,127 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he ... | instruction | 0 | 32,064 | 1 | 64,128 |
Yes | output | 1 | 32,064 | 1 | 64,129 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he ... | instruction | 0 | 32,065 | 1 | 64,130 |
Yes | output | 1 | 32,065 | 1 | 64,131 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he ... | instruction | 0 | 32,066 | 1 | 64,132 |
Yes | output | 1 | 32,066 | 1 | 64,133 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he ... | instruction | 0 | 32,067 | 1 | 64,134 |
Yes | output | 1 | 32,067 | 1 | 64,135 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he ... | instruction | 0 | 32,068 | 1 | 64,136 |
No | output | 1 | 32,068 | 1 | 64,137 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he ... | instruction | 0 | 32,069 | 1 | 64,138 |
No | output | 1 | 32,069 | 1 | 64,139 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he ... | instruction | 0 | 32,070 | 1 | 64,140 |
No | output | 1 | 32,070 | 1 | 64,141 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he ... | instruction | 0 | 32,071 | 1 | 64,142 |
No | output | 1 | 32,071 | 1 | 64,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 i... | instruction | 0 | 32,174 | 1 | 64,348 |
Tags: greedy, implementation, math
Correct Solution:
```
def main():
A, B, F, K = map(int, input().split())
gas = B
refuel = 0
i = 1
while i <= K:
if i % 2:
gas -= F
if gas >= 0:
if K - i > 0 and gas < (A - F) * 2 or \
K - i ==... | output | 1 | 32,174 | 1 | 64,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 i... | instruction | 0 | 32,175 | 1 | 64,350 |
Tags: greedy, implementation, math
Correct Solution:
```
def main():
a, b, f, k = input().split(" ")
endpoint = int(a)
capacity = int(b)
station = int(f)
journeys = int(k)
print(betterBus(endpoint, capacity, station, journeys))
def bus(endpoint, capacity, station, journeys):
refuels = 0
current = capacity
to ... | output | 1 | 32,175 | 1 | 64,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 i... | instruction | 0 | 32,176 | 1 | 64,352 |
Tags: greedy, implementation, math
Correct Solution:
```
import os
import sys
import re
if 'PYCHARM' in os.environ:
sys.stdin = open('in', 'r')
a, b, f, k = map(int, input().split())
x = b
ans = 0
def go(l):
if l > b:
print(-1)
sys.exit(0)
global ans, x
if x < l:
ans += 1
... | output | 1 | 32,176 | 1 | 64,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 i... | instruction | 0 | 32,177 | 1 | 64,354 |
Tags: greedy, implementation, math
Correct Solution:
```
a,b,f,k=map(int,input().split())
tmp=b
flag=0
c=0
for i in range(k):
#print ("i",i,k)
if i%2==0:
#print ("even")
if f>b:
#print (-1)
flag=1
break
else:
b=b-f
if i!=(k-1):
... | output | 1 | 32,177 | 1 | 64,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 i... | instruction | 0 | 32,178 | 1 | 64,356 |
Tags: greedy, implementation, math
Correct Solution:
```
def solve(a, b, f, k):
origb = b
disa = 2*f
disb = 2*(a-f)
trava = False
counter = 0
b -= disa/2
if b < 0:
return -1
while k > 0:
if trava:
trava = False
if k == 1:
disa = d... | output | 1 | 32,178 | 1 | 64,357 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 i... | instruction | 0 | 32,179 | 1 | 64,358 |
Tags: greedy, implementation, math
Correct Solution:
```
a, b, f, k = map(int, input().split())
ans = 0
t = b
l = a - f
x = 0
if b < max(f, l):
ans = -1
else:
while k > 0:
if x == 0:
t -= f
if t < 0:
ans = -1
break
t -= l
if... | output | 1 | 32,179 | 1 | 64,359 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 i... | instruction | 0 | 32,180 | 1 | 64,360 |
Tags: greedy, implementation, math
Correct Solution:
```
def impossible():
print(-1)
exit()
dest, cap, station, journey = map(int, input().strip().split())
left, right = 2 * station, 2*(dest-station)
if journey == 1 and (cap < station or cap < dest-station):
impossible()
if journey == 2 and (cap < station or cap < ... | output | 1 | 32,180 | 1 | 64,361 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 i... | instruction | 0 | 32,181 | 1 | 64,362 |
Tags: greedy, implementation, math
Correct Solution:
```
DEBUG = False
def cover_distance():
"""
Distance [a*k] likes [f]+[2*(a-f)]+[2*f]+[2*(a-f)]+[2*f]+...\
+OR([2*(a-f)]+[f],[2*f]+[a-f])
Last add depends on even/odd of k.
cuts <= b
Cover distance [a*k] by cuts with gr... | output | 1 | 32,181 | 1 | 64,363 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the po... | instruction | 0 | 32,182 | 1 | 64,364 |
Yes | output | 1 | 32,182 | 1 | 64,365 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the po... | instruction | 0 | 32,183 | 1 | 64,366 |
Yes | output | 1 | 32,183 | 1 | 64,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the po... | instruction | 0 | 32,184 | 1 | 64,368 |
Yes | output | 1 | 32,184 | 1 | 64,369 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the po... | instruction | 0 | 32,185 | 1 | 64,370 |
Yes | output | 1 | 32,185 | 1 | 64,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the po... | instruction | 0 | 32,186 | 1 | 64,372 |
No | output | 1 | 32,186 | 1 | 64,373 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the po... | instruction | 0 | 32,187 | 1 | 64,374 |
No | output | 1 | 32,187 | 1 | 64,375 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the po... | instruction | 0 | 32,188 | 1 | 64,376 |
No | output | 1 | 32,188 | 1 | 64,377 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the po... | instruction | 0 | 32,189 | 1 | 64,378 |
No | output | 1 | 32,189 | 1 | 64,379 |
Provide a correct Python 3 solution for this coding contest problem.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.
The w roads in the north-south direction are numbered ... | instruction | 0 | 32,430 | 1 | 64,860 |
"Correct Solution:
```
def s():
for e in iter(input,'0 0'):
w,h=map(int,e.split())
M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
for i in range(1,w):
for j in range(1,h):
a,b=M[i-1][j][:2]
c,d=M[i][j-1][2:]
M[i][j]=[d,a+b,b,c+d]
print((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5)
if'__main__'==_... | output | 1 | 32,430 | 1 | 64,861 |
Provide a correct Python 3 solution for this coding contest problem.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.
The w roads in the north-south direction are numbered ... | instruction | 0 | 32,431 | 1 | 64,862 |
"Correct Solution:
```
for e in iter(input,'0 0'):
w,h=map(int,e.split())
M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
for i in range(1,w):
for j in range(1,h):
a,b=M[i-1][j][:2]
c,d=M[i][j-1][2:]
M[i][j]=[d,a+b,b,c+d]
print((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5)
``` | output | 1 | 32,431 | 1 | 64,863 |
Provide a correct Python 3 solution for this coding contest problem.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.
The w roads in the north-south direction are numbered ... | instruction | 0 | 32,432 | 1 | 64,864 |
"Correct Solution:
```
while True:
w, h = map(int, input().split())
if not w:
break
district = [[0] * w for _ in range(h)]
district[0] = [(1, 0, 0, 0)] * w
for i in range(1, h):
row = district[i]
row[0] = (0, 1, 0, 0)
for j in range(1, w):
left, under = ... | output | 1 | 32,432 | 1 | 64,865 |
Provide a correct Python 3 solution for this coding contest problem.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.
The w roads in the north-south direction are numbered ... | instruction | 0 | 32,433 | 1 | 64,866 |
"Correct Solution:
```
def s():
for e in iter(input,'0 0'):
w,h=map(int,e.split())
M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
for i in range(1,w):
for j in range(1,h):
a,b=M[i-1][j][:2]
c,d=M[i][j-1][2:]
M[i][j]=[d,a+b,b,c+d]
print((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5)
s()
``` | output | 1 | 32,433 | 1 | 64,867 |
Provide a correct Python 3 solution for this coding contest problem.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.
The w roads in the north-south direction are numbered ... | instruction | 0 | 32,434 | 1 | 64,868 |
"Correct Solution:
```
for e in iter(input,'0 0'):
w,h=map(int,e.split())
M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
for i in range(1,w):
for j in range(1,h):
a,b,c,d=[*M[i-1][j][:2],*M[i][j-1][2:]]
M[i][j]=[d,a+b,b,c+d]
print((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5)
``` | output | 1 | 32,434 | 1 | 64,869 |
Provide a correct Python 3 solution for this coding contest problem.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.
The w roads in the north-south direction are numbered ... | instruction | 0 | 32,435 | 1 | 64,870 |
"Correct Solution:
```
# AOJ 0547: Commute routes
# Python3 2018.7.1 bal4u
import sys
from sys import stdin
input = stdin.readline
S, W = 0, 1
while True:
w, h = map(int, input().split())
if w == 0: break
p = [[[[0 for a in range(2)] for b in range(2)] for c in range(h+1)] for d in range(w+1)]
for x in range(1, w... | output | 1 | 32,435 | 1 | 64,871 |
Provide a correct Python 3 solution for this coding contest problem.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.
The w roads in the north-south direction are numbered ... | instruction | 0 | 32,436 | 1 | 64,872 |
"Correct Solution:
```
def main():
while True:
import sys
input=sys.stdin.readline
w,h=map(int,input().split())
if w==0:
break
dp=[[[0,0,0,0] for _ in [0]*(w+1)] for _ in [0]*(h+1)] #右直進、上直進、右、上
dp[1][0]=[0,1,0,0]
dp[0][1]=[1,0,0,0]
mod=10*... | output | 1 | 32,436 | 1 | 64,873 |
Provide a correct Python 3 solution for this coding contest problem.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.
The w roads in the north-south direction are numbered ... | instruction | 0 | 32,437 | 1 | 64,874 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
Commute routes
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0547
"""
import sys
def solve(width, height):
# 北向き 直前に回転あり・回転なし、東向 直前に回転あり・回転なし
dp = [[None] * width for _ in range(height)]
dp[0][0] = [0, 1, 0, 1]
for h in range(height):
... | output | 1 | 32,437 | 1 | 64,875 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.... | instruction | 0 | 32,438 | 1 | 64,876 |
Yes | output | 1 | 32,438 | 1 | 64,877 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.... | instruction | 0 | 32,439 | 1 | 64,878 |
Yes | output | 1 | 32,439 | 1 | 64,879 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.... | instruction | 0 | 32,440 | 1 | 64,880 |
No | output | 1 | 32,440 | 1 | 64,881 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.... | instruction | 0 | 32,441 | 1 | 64,882 |
No | output | 1 | 32,441 | 1 | 64,883 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
problem
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction and h roads that extend straight in the east-west direction.... | instruction | 0 | 32,442 | 1 | 64,884 |
No | output | 1 | 32,442 | 1 | 64,885 |
Provide tags and a correct Python 3 solution for this coding contest problem.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell.... | instruction | 0 | 32,922 | 1 | 65,844 |
Tags: dfs and similar, graphs, implementation
Correct Solution:
```
n,t = map(int,input().split())
a = list(map(int,input().split()))
v = []
i = 0
while i <= n-1:
v.append(i+1)
if i == n-1:
break
elif i < n-1:
i += a[i]
print(['NO','YES'][t in v])
``` | output | 1 | 32,922 | 1 | 65,845 |
Provide tags and a correct Python 3 solution for this coding contest problem.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell.... | instruction | 0 | 32,923 | 1 | 65,846 |
Tags: dfs and similar, graphs, implementation
Correct Solution:
```
from sys import stdin, stdout
n, t = stdin.readline().split()
n = int(n)
t = int(t) - 1
arr = stdin.readline().split()
arr.append('0')
ans = False
idx = 0
while not ans:
if idx == t:
ans = True
if idx == n - 1:
break
i... | output | 1 | 32,923 | 1 | 65,847 |
Provide tags and a correct Python 3 solution for this coding contest problem.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell.... | instruction | 0 | 32,924 | 1 | 65,848 |
Tags: dfs and similar, graphs, implementation
Correct Solution:
```
b = int(input().split() [1])
f = [0] + [int(x) for x in input().split()]
i = 1
while i < b:
i = i + f[i]
if i == b:
print("YES")
quit()
print("NO")
``` | output | 1 | 32,924 | 1 | 65,849 |
Provide tags and a correct Python 3 solution for this coding contest problem.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell.... | instruction | 0 | 32,925 | 1 | 65,850 |
Tags: dfs and similar, graphs, implementation
Correct Solution:
```
def newYear(n,t,list):
i = 1
while i < t:
i += list[i-1]
if i == t:
print("YES")
return
print("NO")
return
params = input().split()
n = int(params[0])
t = int(params[1])
params = input().split()
for i in ra... | output | 1 | 32,925 | 1 | 65,851 |
Provide tags and a correct Python 3 solution for this coding contest problem.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell.... | instruction | 0 | 32,926 | 1 | 65,852 |
Tags: dfs and similar, graphs, implementation
Correct Solution:
```
# n,t=map(int,input().split())
n,t=map(int,input().split())
arr=list(map(int,input().split()))
visit=[1]
i=0
while True:
try:
visit.append(i+arr[i]+1)
i=i+arr[i]
except:
break
if t in visit:
print("YES")
else:
pr... | output | 1 | 32,926 | 1 | 65,853 |
Provide tags and a correct Python 3 solution for this coding contest problem.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell.... | instruction | 0 | 32,927 | 1 | 65,854 |
Tags: dfs and similar, graphs, implementation
Correct Solution:
```
n,t=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
def f(z):
return z+a[z-1]
i=1
while i<=n:
i=f(i)
if i==t:
print('YES')
break
elif i>t:
print('NO')
break
``` | output | 1 | 32,927 | 1 | 65,855 |
Provide tags and a correct Python 3 solution for this coding contest problem.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell.... | instruction | 0 | 32,928 | 1 | 65,856 |
Tags: dfs and similar, graphs, implementation
Correct Solution:
```
n, t = map(int, input().split())
a = list(map(int, input().split()))
visited = [False] * n
visited[0] = False
u = 0
while u < n-1:
visited[u] = True
u = u + a[u]
visited[u] = True
if visited[t-1]:
print("YES")
else:
print("NO")
``` | output | 1 | 32,928 | 1 | 65,857 |
Provide tags and a correct Python 3 solution for this coding contest problem.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell.... | instruction | 0 | 32,929 | 1 | 65,858 |
Tags: dfs and similar, graphs, implementation
Correct Solution:
```
n,t=[int(i) for i in input().split()]
lst=[int(i) for i in input().split()]
c=1
nk=0
while True:
if c<t:
c=lst[c-1]+c
elif c==t:
print("YES")
break
else:
nk=1
break
if nk==1:
print('NO')
``` | output | 1 | 32,929 | 1 | 65,859 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, ... | instruction | 0 | 32,930 | 1 | 65,860 |
Yes | output | 1 | 32,930 | 1 | 65,861 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, ... | instruction | 0 | 32,931 | 1 | 65,862 |
Yes | output | 1 | 32,931 | 1 | 65,863 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.