Problem:


Score : 300 points

Problem Statement

AtCoDeer the deer is going on a trip in a two-dimensional plane.
In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.

If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).
Note that he cannot stay at his place.
Determine whether he can carry out his plan.

Constraints

1 ≤ N ≤ 10^5

0 ≤ x_i ≤ 10^5

0 ≤ y_i ≤ 10^5

1 ≤ t_i ≤ 10^5

t_i < t_{i+1} (1 ≤ i ≤ N-1)

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N

Output

If AtCoDeer can carry out his plan, print Yes; if he cannot, print No.

Sample Input 1

2
3 1 2
6 1 1

Sample Output 1

Yes

For example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).

Sample Input 2

1
2 100 100

Sample Output 2

No

It is impossible to be at (100,100) two seconds after being at (0,0).

Sample Input 3

2
5 1 1
100 1 1

Sample Output 3

No



Sample input:
2
3 1 2
6 1 1


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools

logging.basicConfig(level=logging.ERROR)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	current = [0,0,0]
	flag = True
	for i in range(int(input())):
		c = list(map(int,input().split()))
		mh = abs(c[1]-current[1]) + abs(c[2]-current[2])
		if(abs(c[0]-current[0])%2 != mh%2):
			flag = False
		current = c
	if flag:
		print('Yes')
	else:
		print('No')
main()

Submission status: Wrong Answer

Solution code:
N = int(input())
flag = True
for i in range(N):

    t,x,y = map(int, input().split(" "))

    if x+y>t or t%2 !=(x+y)%2:
        flag=False
        break

print("Yes" if flag else "no")

Submission status: Wrong Answer

Solution code:

N = int(input())
flag = True
for i in range(N):

    t,x,y = list(map(int, input().split(" ")))

    if x+y>t or t%2 !=(x+y)%2:
        flag=False

print("Yes" if flag else "no")

Submission status: Wrong Answer

Solution code:
N = int(input())

t0, x0, y0 = 0, 0, 0
for _ in range(N):
    t, x, y = map(int, input().split())
    dt = t - t0
    dx = x - x0
    dy = y - y0
    dxy = abs(dx) + abs(dy)  #; print(dt, dx, dy, dxy) 
    isEvenOdd = (dt%2 == 0 and dxy%2 == 0) or (dt%2 != 0 and dxy%2 != 0)
    if isEvenOdd and dxy <= dt :
        t0, x0, y0 = t, x, y
    else:
        print('NO')
        break
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(n):
    t, x, y = map(int, input().split())
    if x+y > t or x+y+t % 2:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(n):
    t, x, y = map(int, input().split())
    if x+y > t or x+y+t % 2:
        print("NO")
        exit()
print("YES")

Submission status: Wrong Answer

Solution code:
for_num = int(input())

judge = "No"
for i in range(0,for_num):
  nums = input()
  nums = nums.split()
  t = int(nums[0])
  reach_x_coord = int(nums[1])
  reach_y_coord = int(nums[2])
  sum_coord = reach_x_coord + reach_y_coord
  if sum_coord == t:
    judge = "Yes"
  elif sum_coord > t:
    pass
  else:
    if (t-sum_coord)%2 != 0:
      pass
    else:
      m_hanni = int((t-sum_coord)/2)
      print(m_hanni)
      for a in range(0,t+1):
        if judge == "Yes":
          break
        else:
          for b in range(0,m_hanni+1):
            x = (+1)*a + (-1)*b
            y = (+1)*(t-a) + (-1)*(m_hanni-b)
            #print(x,y)
            if (x == reach_x_coord) and (y == reach_y_coord):
              judge = "Yes"
              break
            else:
              judge = "No"

print(judge)

Submission status: Wrong Answer

Solution code:
for_num = int(input())

judge = "No"
for i in range(0,for_num):
  nums = input()
  nums = nums.split()
  t = int(nums[0])
  reach_x_coord = int(nums[1])
  reach_y_coord = int(nums[2])
  sum_coord = reach_x_coord + reach_y_coord
  if sum_coord == t:
    judge = "Yes"
  elif sum_coord > t:
    pass
  else:
    if ((t-sum_coord)/2)%2 != 0:
      pass
    else:
      m_hanni = int((t-sum_coord)/2)
      print(m_hanni)
      for a in range(0,t+1):
        if judge == "Yes":
          break
        else:
          for b in range(0,m_hanni+1):
            x = (+1)*a + (-1)*b
            y = (+1)*(t-a) + (-1)*(m_hanni-b)
            #print(x,y)
            if (x == reach_x_coord) and (y == reach_y_coord):
              judge = "Yes"
              break
            else:
              judge = "No"

print(judge)

Submission status: Wrong Answer

Solution code:
for_num = int(input())

judge = "No"
for i in range(0,for_num):
  nums = input()
  nums = nums.split()
  t = int(nums[0])
  reach_x_coord = int(nums[1])
  reach_y_coord = int(nums[2])
  sum_coord = reach_x_coord + reach_y_coord
  if sum_coord == t:
    judge = "Yes"
  elif sum_coord > t:
    pass
  else:
    m_hanni = int((t-sum_coord)/2)
    for a in range(0,t+1):
      if judge == "Yes":
        break
      else:
        for b in range(0,m_hanni+1):
          x = (+1)*a + (-1)*b
          y = (+1)*(t-a) + (-1)*(m_hanni-b)
          #print(x,y)
          if (x == reach_x_coord) and (y == reach_y_coord):
            judge = "Yes"
            break
          else:
            judge = "No"

print(judge)

Submission status: Wrong Answer

Solution code:
n=int(input())
nx=0
ny=0
nt=0
for i in range(n):
  t,x,y=map(int,input().split())
  k=abs(x-nx)+abs(y-ny)
  if k>nt-t:
    print("No")
    exit()
  elif k%2 != (nt-t)%2:
    print("No")
    exit()
  nt,nx,ny=t,x,y
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
ans = 'Yes'

for a in A:
    if a[0] % (a[1] + a[2]) != 0:
        ans = 'No'
        break

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
Flg = True
for _ in range(n):
    t, x, y = map(int, input().split())
    xy = x+y
    if t >= (xy):
        if ((t % 2 != 0) & (xy % 2 == 0)) or (t % 2 == 0 & xy % 2 != 0):
            Flg = False
    else:
        Flg = False
if Flg == True:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
time, x, y = 0, 0, 0
for i in range(N):
    time = A[i][0] - time
    x = A[i][1] - x
    y = A[i][2] - y
    move = x + y
    if time >= move:
        if(move*time)%2==1 or (move*time)%4==0:
            ans = "Yes"
        else:
            ans = "No"
    else:
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
flag = 'Yes'
txy = [[0,0,0]]
for i in range(N):
    a = list(map(int,input().split()))
    txy.append(a)
    td = txy[i][0] - txy[i-1][0]
    xd = abs(txy[i][1] - txy[i-1][1])
    yd = abs(txy[i][2] - txy[i-1][2])
    if (td < xd + yd) or ((td-(xd+yd))%2 == 1):
        flag = 'No'
print(flag)

Submission status: Wrong Answer

Solution code:
N=int(input())
t=[]
x=[]
y=[]
for i in range(N):
    t1, x1, y1=map(int, input().split())
    t.append(t1)
    x.append(x1)
    y.append(y1)
for j in range (N):
    if t[j]%2==(x[j]+y[j])%2 and x[j]<=t[j] and y[j]<=t[j]:
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(n):
    T, X, Y = map(int, input().split())
    t.append(T)
    x.append(X)
    y.append(Y)

count = 0
for i in range(1, len(t)+1):
    if (x[i]+y[i])%2 == 0 and t[i]%2 == 0 and t[i]-t[i-1]>abs(x[i]-x[i-1])+abs(y[i]-y[i-1]):
        count += 1
    elif (x[i]+y[i])%2 == 1 and t[i]%2 == 1and t[i]-t[i-1]>abs(x[i]-x[i-1])+abs(y[i]-y[i-1]):
        count += 1
    else:
        break
print('Yes' if count == len(t) else 'No')

Submission status: Wrong Answer

Solution code:
n = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(n):
    T, X, Y = map(int, input().split())
    t.append(T)
    x.append(X)
    y.append(Y)

count = 0
for i in range(len(t)):
    if (x[i]+y[i])%2 == 0 and t[i]%2 == 0:
        count += 1
    elif (x[i]+y[i])%2 == 1 and t[i]%2 == 1:
        count += 1
    else:
        break
print('Yes' if count == len(t) else 'No')

Submission status: Wrong Answer

Solution code:
n = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(n):
    T, X, Y = map(int, input().split())
    t.append(T)
    x.append(X)
    y.append(Y)
print(t, x, y)

count = 0
for i in range(len(t)):
    if (x[i]+y[i])%2 == 0 and t[i]%2 == 0:
        count += 1
    elif (x[i]+y[i])%2 == 1 and t[i]%2 == 1:
        count += 1
    else:
        break
print('Yes' if count == len(t) else 'No')
print(count)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
txy2 = [list(map(int,input().split())) for _ in range(N)]
txy = [[0,0,0]]
for i in range(N):
    txy.append(txy2[i])
for i in range(N):
    if abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2]) > txy[i+1][0]-txy[i][0]:
        print("No")
        sys.exit()
    elif ((txy[i+1][0]-txy[i][0]) - (abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])))%2 != 0:
        print("No")
        sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
txy2 = [list(map(int,input().split())) for _ in range(N)]
txy = [[0,0,0]]
for i in range(N):
    txy.append(txy2[i])
for i in range(N):
    if abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2]) > txy[i+1][0]-txy[i][0]:
        print("No")
        sys.exit()
    elif txy[i+1][1] == txy[i][1] and txy[i+1][2] == txy[i][2]:
        if (txy[i+1][0]-txy[i][0])%2 != 0:
            print("No")
            sys.exit()
    elif txy[i+1][1] == txy[i][1] or txy[i+1][2] == txy[i][2]:
        if (txy[i+1][0]-txy[i][0])%2 != 1:
            print("No")
            sys.exit()
            
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
txy2 = [list(map(int,input().split())) for _ in range(N)]
txy = [[0,0,0]]
for i in range(N):
    txy.append(txy2[i])
for i in range(N):
    if abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2]) > txy[i+1][0]-txy[i][0]:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
pt, px, py = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    a = abs(x - px) + abs(y - py)
    b = t - pt
    if b < a or (a - b) % 2 != 0:
        print("No")
        exit()
    pt, px, py = t - pt, x, y
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
pt, px, py = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    a = abs(x - px) + abs(y - py)
    b = t - pt
    if b < a or (a - b) % 2:
        print("No")
        exit()
    pt, px, py = t - pt, x, y
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
pt, px, py = [0, 0, 0]
for i in range(N):
    t, x, y = map(int, input().split())
    a = abs(x - px) + abs(y - py)
    b = t - pt
    if b < a or a % 2 != b % 2:
        print("No")
        exit()
    pt, px, py = t-pt, x, y
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
lis = [list(map(int, input().split())) for i in range(N)]
t, x, y = 0, 0, 0
for i in range(N):
    a = abs(x - lis[i][1]) + abs(y - lis[i][2])
    b = lis[i][0] - t
    if b >= a and a % 2 == b % 2:
        t += lis[i][0]
        x = lis[i][1]
        y = lis[i][2]
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
lis = [list(map(int, input().split())) for i in range(N)]
t, x, y = 0, 0, 0
for i in range(N):
    d = abs(x - lis[i][1]) + abs(y - lis[i][2])
    dt = lis[i][0] - t
    if dt < d or dt % 2 != d % 2:
        print("No")
        exit()
    else:
        t += lis[i][0]
        x = lis[i][1]
        y = lis[i][2]
print("Yes")

Submission status: Wrong Answer

Solution code:
def func(t, x, y):
    if t%2 == 0:
        if not (x + y)%2 == 0 :
            return 1
    else:
        if not (x + y)%2 == 1 :
            return 1

n = int(input())
# t, x, y = [map(int, input().split()) for _ in range(n)]
t, x, y = [0]*(n+1),[0]*(n+1),[0]*(n+1)
for i in range(1,n+1):
    t[i], x[i], y[i] = map(int, input().split())

flg = 0
for i in range(1,n+1):
    flg = func(t[i]-t[i-1], x[i]-x[i-1], y[i]-y[i-1])
    if flg == 1 :
        print("No")
        break
if flg == 0:
    print("Yes")

Submission status: Wrong Answer

Solution code:
def func(t, x, y):
    if t%2 == 0:
        for j in range( int(t/2 + 1)) :
            if not (x + y)%2 == 0 :
                return 1
    else:
        for j in range( int((t-1)/2 + 1) ):
            if not (x + y)%2 == 1 :
                return 1

n = int(input())
# t, x, y = [map(int, input().split()) for _ in range(n)]
t, x, y = [0]*(n+1),[0]*(n+1),[0]*(n+1)
flg = 0
for i in range(1,n+1):
    t[i], x[i], y[i] = map(int, input().split())
    flg = func(t[i]-t[i-1], x[i]-x[i-1], y[i]-y[i-1])
if flg == 1:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
def func(t, x, y):
    if t%2 == 0:
        for j in range( int(t/2 + 1)) :
            if not y == x + j*2 and y == -x - j*2 and y == -x + j*2 and y == x - j*2:
                return 1
    if t == 1:
        for j in range( int((t-1)/2 + 1) ):
            if not y == x + j*2+1 and y == -x - j*2-1 and y == -x + j*2+1 and y == x - j*2-1 :
                return 1
            if  (y == 0 and x == 0):
                return 1
    else:
        for j in range( int((t-1)/2 + 1) ):
            if not y == x + j*2+1 and y == -x - j*2-1 and y == -x + j*2+1 and y == x - j*2-1 :
                return 1

n = int(input())
# t, x, y = [map(int, input().split()) for _ in range(n)]
t, x, y = [0]*(n+1),[0]*(n+1),[0]*(n+1)
flg = 0
for i in range(1,n+1):
    t[i], x[i], y[i] = map(int, input().split())
    flg = func(t[i]-t[i-1], x[i]-x[i-1], y[i]-y[i-1])
if flg == 1:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('NO')
        exit()
    elif (-(x2-x1 + y2-y1) + (t2-t1)) % 2 == 0:
        t1=t2
        x1=x2
        y1=y2
        continue
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('NO')
        exit()
    elif (x2-x1 + y2-y1)%2 == (t2-t1)%2:
        t1=t2
        x1=x2
        y1=y2
        continue
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('NO')
        exit()
    elif (x2-x1 + y2-y1)%2 == (t2-t1)%2:
        t1=t2
        x1=x2
        y1=y2
        continue
    else:
        print('NO')
        exit()

print('YES')

Submission status: Wrong Answer

Solution code:
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('NO')
        exit()
    elif (x2-x1 + y2-y1)%2 == (t2-t1)%2:
        continue
    else:
        print('NO')
        exit()

print('YES')

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
t0=0
x0,y0=0,0
dt=0
dx,dy,d=0,0,0
for i in range(N):
    t,x,y=map(int,input().split())
    dt=t-t0
    dx=x-x0
    dy=y-y0
    d=abs(dx)+abs(dy)
    if d>t or dt%2!=d%2:
        print("NO")
        sys.exit()
    else:
        t0=t
        x0=x
        y0=y
print("YES")

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
txy = [LIST() for _ in range(N)]

def dist(p1, p2):
	return abs(p1[0]-p2[0])+abs(p1[1]-p2[1])

now = [0, 0]
time = 0
for t, x, y in txy:
	if (t-time) < dist(now, [x, y]) or ((t-time) - dist(now, [x, y]))%2!=0:
		print("No")
		break
	time += t
	now[0] = x
	now[1] = y
else:
	print("Yes")

Submission status: Wrong Answer

Solution code:
def odd_even(a, b):
    if a % 2 == b % 2:
        return True
    else:
        return False

n = int(input())
T, X, Y = [0], [0], [0]
for _ in range(n):
    t, x, y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

ans = 'Yes'

for i in range(1,n+1):
    t_dif = T[i] - T[i-1]
    x_dif = abs(X[i]-X[i-1])
    y_dif = abs(Y[i]-Y[i-1])
    if t_dif <= (x_dif + y_dif) and odd_even(t_dif, x_dif+y_dif):
        pass
    else:
        ans = 'No'
        break

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
flg = True
t, x, y = 0, 0, 0
for i in range(n):
    nt, nx, ny = map(int, input().split()) 
    dist = abs(x - nx) + abs(y - ny)
    dt = nt - t
    if dist > dt or (dist - dt) % 2 == 1:
        print("NO")
        flg = False
        break
    t, x, y = nt, nx, ny
if flg == True:
    print("YES")

Submission status: Wrong Answer

Solution code:
nums = int(input())
tmp = list()
for num in range(nums):
    tmp.append([int(_) for _ in str(input()).split(" ")])

for num, case in enumerate(tmp):
    t, x, y = case
    if t < abs(x) + abs(y):
        print("No")
        break
    else:
        if ((abs(x) + abs(y)) % 2) and (t % 2):
            if num == len(tmp):
                print("Yes")
        elif ((abs(x) + abs(y)) % 2 == 0) and (t % 2 == 0):
            if num == len(tmp):
                print("Yes")
        else:
            print("No")
            break

Submission status: Wrong Answer

Solution code:
N = int(input())
T = []
Z = []
time = []
T.append([0,0,0])
for i in range(N):
    t = list(map(int, input().split()))
    T.append(t)
goal = True

for l in range(len(T)-1):
    Z.append(abs(T[l+1][1]-T[l][1]) + abs(T[l+1][2]-T[l][2]))
    time.append(T[l+1][0] - T[l][0])

for j in range(len(T)-1):
    if Z[j] > time[j] or Z[j]%2 != time[j]%2:
        goal = False
        break

if goal == False:
    print('NO')
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
import math
ans =[]
N = int(input())
points = {'t':[0],'x':[0],'y':[0]}
for i in range(N):
  t,x,y = map(int, input().split())
  points['t'].append(t)
  points['x'].append(x)
  points['y'].append(y)

for i in range(N):
  n = int(math.log2(points['t'][i+1]))

  for j in range(n):
    a = int(points['x'][i+1])+int(points['y'][i+1])
    b = int(points['x'][i])+int(points['y'][i])
    c = int(points['t'][i+1]) - int(points['t'][i])

    if a-b==c:
      ans.append(1)
      pass
    elif a-b+2**(j+1)==c:
      ans.append(1)
      pass
      
if sum(ans)==N:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import math
ans =[]
N = int(input())
points = {'t':[0],'x':[0],'y':[0]}
for i in range(N):
  t,x,y = map(int, input().split())
  points['t'].append(t)
  points['x'].append(x)
  points['y'].append(y)

for i in range(N):
  n = int(math.log2(points['t'][i+1]))

  for j in range(n):
    a = int(points['x'][i+1])+int(points['y'][i+1])
    b = int(points['x'][i])+int(points['y'][i])
    c = int(points['t'][i+1]) - int(points['t'][i])

    if a-b==c:
      ans.append(1)
    elif a-b+2**(j+1)==c:
      ans.append(1)
      
if sum(ans)==N:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import math
ans =[]
N = int(input())
points = {'t':[],'x':[],'y':[]}
for i in range(N):
  t,x,y = map(int, input().split())
  points['t'].append(t)
  points['x'].append(x)
  points['y'].append(y)

for i in range(N):
  n = int(math.log2(points['t'][i]))

  for j in range(n):

    if int(points['x'][i])+int(points['y'][i])==int(points['t'][i]):
      ans.append(1)
    if int(points['x'][i])+int(points['y'][i])+2**(j+1)==int(points['t'][i]):
      ans.append(1)
      
if sum(ans)==N:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

result = 1
bt=0
bx=0
by= 0

for i in range(N):
	t, x, y = map(int, input().split())
	distance = abs(x-bx) + abs(y-by)
	dur = t - bt
	print(t,x,y,distance, dur)
	if dur - distance >= 0 and (dur - distance) %2 == 0:
		(bt,bx,by) = (t,x,y)
		continue
	else:
		result = 0
		break

if result:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

result = 1
bt=0
bx=0
by= 0

for i in range(N):
	t, x, y = map(int, input().split())
	distance = abs(x-bx) + abs(y-by)
	dur = t - bt
#	print(t,x,y,distance, dur)
	if dur - distance > 0 and (dur - distance) %2 == 0:
		(bt,bx,by) = (t,x,y)
		continue
	else:
		result = 0
		break

if result:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n = int(input())
points = []
for i in range(n):
    points.append(list(map(int, input().split())))

def can_exist(before_point, after_point):
    def_t = after_point[0] - before_point[0]
    def_x = after_point[1] - before_point[1]
    def_y = after_point[2] - before_point[2]
    def_total = abs(def_x) + abs(def_y)
    if def_total <= def_t and def_total % 2 == def_t % 2:
        return True
    else:
        return False

out = 'Yes'
for i in range(n-1):
    if can_exist(points[i], points[i+1]):
        continue
    else:
        out = 'No'
        break

print(out)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
travel_list = [np.array([0, 0, 0])]
add_list = [np.array([int(i) for i in input().split()]) for i in range(N)] 
travel_list.extend(add_list)

def is_travel(arr1, arr2):
    dt, dx, dy = abs(arr2 - arr1)
    if dt <= dx + dy:
        return False
    elif dt % 2 != (dx + dy) % 2:
        return False
    else:
        return True
        

for i in range(N):
    if is_travel(travel_list[i], travel_list[i+1]):
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
travel_list = [np.array([0, 0, 0])]
add_list = [np.array([int(i) for i in input().split()]) for i in range(N)] 
travel_list.extend(add_list)

def is_travel(arr1, arr2):
    dt, dx, dy = abs(arr2 - arr1)
    if dt <= dx + dy:
        return False
    elif dt % 2 != (dx + dy) % 2:
        return False
    else:
        return True
        

for i in range(N):
    if is_travel(travel_list[i], travel_list[i+1]):
        continue
    else:
        print('NO')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(n):
  t, A, B = map(int, input().split())
  if t < (A+B):
    print('NO')
    exit()
  if (t%2==0 and (A+B)%2!=0) or (t%2!=0 and (A+B)%2==0) :
    print('NO')
    exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
row_length = int(input())
point = {}
for i in range(row_length):
    point[i] = list(map(int, input().split()))
from math import ceil
def feasible_point(t, x, y):
    if t % 2 == 0:  # tが偶数の時
        k = t / 2
        # (x,y)がk * kの間にある偶数点ならばokを返す
        if ((x+y)%2 == 0)&(x <= k)&(y <= k):
            return True
        else:
            return False
    else:
        k = ceil(t / 2)
        # (x,y)がk * kの間にある奇数点ならばokを返す
        if ((x+y)%2 == 1)&(x <= k)&(y <= k):
            return True
        else:
            return False

check_list = []
for j in range(len(point)):
    check_list.append(feasible_point(point[j][0], point[j][1], point[j][2]))

if all(check_list):
    # 各点同士の両立可能性を調べる
    check_list_2 = []
    for l in range(len(point)-1):
        t_gap = point[l+1][0] - point[l][0]
        xy_gap = point[l+1][1] + point[l+1][2] - point[l][1] - point[l][2]
        if abs(xy_gap) <= abs(t_gap):
            check_list_2.append(True)
        else:
            check_list_2.append(False)
    if all(check_list_2):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
row_length = int(input())
point = {}
for i in range(row_length):
    point[i] = list(map(int, input().split()))
from math import ceil
def feasible_point(t, x, y):
    if t % 2 == 0:  # tが偶数の時
        k = t / 2
        # (x,y)がk * kの間にある偶数点ならばokを返す
        if ((x+y)%2 == 0)&(x <= k)&(y <= k):
            return True
        else:
            return False
    else:
        k = ceil(t / 2)
        # (x,y)がk * kの間にある奇数点ならばokを返す
        if ((x+y)%2 == 1)&(x <= k)&(y <= k):
            return True
        else:
            return False

check_list = []
for j in range(len(point)):
    check_list.append(feasible_point(point[j][0], point[j][1], point[j][2]))

if all(check_list):
    # 各点同士の両立可能性を調べる
    check_list_2 = []
    for l in range(len(point)-1):
        t_gap = point[l+1][0] - point[l][0]
        xy_gap = point[l+1][1] + point[l+1][2] - point[l][1] - point[l][2]
        if xy_gap <= t_gap:
            check_list_2.append(True)
        else:
            check_list_2.append(False)
    if all(check_list_2):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
row_length = int(input())
point = {}
for i in range(row_length):
    point[i] = list(map(int, input().split()))
from math import ceil
def feasible_point(t, x, y):
    if t % 2 == 0:  # tが偶数の時
        k = t / 2
        # (x,y)がk * kの間にある偶数点ならばokを返す
        if ((x+y)%2 == 0)&(x <= k)&(y <= k):
            return True
        else:
            return False
    else:
        k = ceil(t / 2)
        # (x,y)がk * kの間にある奇数点ならばokを返す
        if ((x+y)%2 == 1)&(x <= k)&(y <= k):
            return True
        else:
            return False

check_list = []
for j in range(len(point)):
    check_list.append(feasible_point(point[j][0], point[j][1], point[j][2]))

if all(check_list):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
t_x_y = [0]*N
for n in range(N):
    t_x_y[n] = [int(x) for x in input().split()]
    
can_flag = 1
for t, x, y in t_x_y: 
    if (t%2 == (x+y)%2) & (x+y)<=2*t:
        continue
    else:
        can_flag=0
        break

if can_flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
t_x_y = [0]*N
for n in range(N):
    t_x_y[n] = [int(x) for x in input().split()]
    
can_flag = 1
for t, x, y in t_x_y: 
    if (t%2 == (x+y)%2) & (x+y)<=t:
        continue
    else:
        can_flag=0
        break

if can_flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
t_x_y = [0]*N
for n in range(N):
    t_x_y[n] = [int(x) for x in input().split()]
    
can_flag = 1
for t, x, y in t_x_y: 
    if (t%2 == (x+y)%2):
        if (x+y)<=2*t or (x+y) >= -2*t:
            continue
        else:
            can_flag=0
            break
    else:
        can_flag=0
        break

if can_flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
t_x_y = [0]*N
for n in range(N):
    t_x_y[n] = [int(x) for x in input().split()]
    
can_flag = 1
for t, x, y in t_x_y: 
    if (t%2 == (x+y)%2):
        if (x+y)<=t or (x+y) >= -t:
            continue
        else:
            can_flag=0
            break
    else:
        can_flag=0
        break

if can_flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
t_x_y = [0]*N
for n in range(N):
    t_x_y[n] = [int(x) for x in input().split()]
    
can_flag = 1
for t, x, y in t_x_y: 
    if (t%2 == (x+y)%2) & ((x+y)<=2*t):
        continue
    else:
        can_flag=0
        break

if can_flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
TXY = []
for n in range(N):
    TXY.append([int(i) for i in input().split()])
temp = [0,0,0]
ans = True
for txy in TXY:
    dist = (txy[1]-temp[1]) + (txy[2]-temp[2])
    if (txy[0]-temp[0]) % 2 == dist % 2:
        temp = txy
    else:
        ans = False
print("Yes") if ans else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]


for i in range(N):
    now = txy[i]
    next = txy[i + 1]
    root = abs(next[1] - now[1]) + abs(next[2] - now[2])
    print(root)
    time = next[0] - now[0]
    if time < root:
        print("No")
        break
    else:
        if time == root:
            pass
        else:
            if (time - root) % 2 != 0:
                print("No")
                break
else:
    if N == 1:
        root = txy[1][1] + txy[1][2]
        time = txy[1][0]
        if time < root:
            print("No")
        else:
            if (time - root) % 2 == 0:
                print("Yes")
            else:
                print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input()) 
pre_t=0
pre_x=0
pre_y=0
for i in range(N):
    now_t,now_x,now_y=list(map(int,input().split()))
    d=abs(pre_x-now_x)+abs(pre_y-now_y)
    t=pre_t-now_t
    if d<=t and t%2==d%2:
        flg=1
    else:
        flg=0
        break
if flg==1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from sys import stdin
import statistics
from math import factorial
import math
 
n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]

#重複なし組み合わせ
from itertools import combinations
lin = list(combinations(li,2))

lis = []

for i in range(len(lin)):

    a = (lin[i][1][1]-lin[i][0][1])**2
    b = (lin[i][1][0]-lin[i][0][0])**2
    c = math.sqrt(a+b)
    lis.append(c)

lin = list(combinations(lis, 2))

if len(lin) == 1:
    print(lin[0])
    exit()

liv = []
point =0

for i in range(len(lin)):
    point += sum(lin[i])/2

print(point/n)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]

flag = True
for i in range(N):
    if A[i][1] + A[i][2] > A[i][0]:
        flag = False
        break
print("Yes" if flag else "No")

Submission status: Wrong Answer

Solution code:
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = ((x - self.now_x) + (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if (distance - duration) % 2 == 0:
            return False

        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')