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:
#! env python
# -*- coding: utf-8 -*-

import os
import sys

# at_coder.ABC086C_Traveling
# Date: 2019/06/02
# Filename: ABC086C_Traveling 

__author__ = 'acto_mini'
__date__ = "2019/06/02"


def main():
    # 作業ディレクトリを自身のファイルのディレクトリに変更
    os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))

    t, x, y = [0], [0], [0]

    # 整数の入力
    num = int(input())

    for i in range(num):
        a, b, c = map(int, input().split())
        t.append(a)
        x.append(b)
        y.append(c)

    can = True
    for i in range(num):
        dt = t[i+1] - t[i]
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
        if (dt < dist):
            can = False
        if (dt % 2 != dist %2):
            can = False


    if can:
        print("YES")
    else:
        print("No")

    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
TXY = [[int(x) for x in input().split()] for _ in range(N)]

pt,px,py = 0,0,0

bl = True
for t,x,y in TXY:
  dt = abs(t-pt)
  dx = abs(x-px)
  dy = abs(y-py)
  px = x
  py = y
  pt = t
  if dt > dx+dy:
    bl = False
    break
  if (dt-(dx+dy))&1:
    bl = False
    break

print('Yes' if bl else 'No')

Submission status: Wrong Answer

Solution code:
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]

info.insert(0, [0, 0, 0])
x_diff, y_diff = 0, 0

for i in range(n):
    dt = info[i+1][0] - info[i][0]
    x_diff = abs(info[i+1][1] - info[i][1])
    y_diff = abs(info[i+1][2] - info[i][2])
    if dt < x_diff + y_diff:
        print('NO')
        exit()
    if dt%2 != (x_diff + y_diff)%2:
        print('NO')
        exit()

print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
a = 0
def trav(a,b,c,d,e,f):
    if abs(a-b) + abs(c-d) <= e - f and ((a-b) % 2 + (c-d) % 2)%2 == (e-f) % 2:
        return 0
    else:
        return 1
for i in range(n):
    tn,xn,yn = map(int,input().split())
    if trav(xn,x,yn,y,tn,t) == 0:
        a = 0
        x = xn
        y = yn
        t = tn
    else:
        a = 1
if a == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
x = [0]
y = [0]
t = [0]
fl = True
def judge(a,b,c,d,e,f):
    if abs(b-c)+abs(d-c) <= f-e and abs(b+d-a-c)%2 == abs(f-e)%2:
        return False
    return True
for i in range(n):
    tt,xx,yy = map(int,input().split())
    x.append(xx)
    y.append(yy)
    t.append(tt)
    if judge(x[i],x[i+1],y[i],y[i+1],t[i],t[i+1]):
        fl = False
if(fl):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
x = [0]
y = [0]
t = [0]
fl = True
def judge(a,b,c,d,e,f):
    if abs(b-c)+abs(d-c) <= f-e and abs(b+d-a-c)%2 == abs(f-e)%2:
        return False
    return True
for i in range(n):
    tt,xx,yy = map(int,input().split())
    x.append(xx)
    y.append(yy)
    t.append(tt)
    if judge(x[i],x[i+1],y[i],y[i+1],t[i],t[i+1]):
        fl = False
        break
if(fl):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
a = 0
def trav(a,b,c,d,e,f):
    if abs(a-b) + abs(c-d) <= e - f and (a-b) % 2 + (c-d) % 2 == (e-f) % 2:
        return 0
    else:
        return 1
for i in range(n):
    tn,xn,yn = map(int,input().split())
    if trav(xn,x,yn,y,tn,t) == 0:
        x = xn
        y = yn
        t = tn
    else:
        a = 1
if a == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
a = 0
def trav(a,b,c,d,e,f):
    if abs(a-b) + abs(c-d) <= e - f and (a-b) % 2 + (c-d) % 2 == (e-f) % 2:
        return 0
    else:
        return 1
for i in range(n):
    tn,xn,yn = map(int,input().split())
    if trav(xn,x,yn,y,tn,t) == 0:
        a = 0
        x = xn
        y = yn
        t = tn
    else:
        a = 1
if a == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=input()
x1=0
y1=0
t1=0
success=True
for i in range(int(n)):
    t,x,y = map(int,input().split())
    w = abs(x - x1) + abs(y - y1)
    print(w)
    if w > abs(t - t1):
        success=False
        break
    if w % 2 != abs(t -t1) % 2:
        success=False
        break
    x1 = x
    y1 = y
    t1 = t

print("Yes") if success else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
X = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
print('Yes' if all((X[i + 1][0] - X[i][0] - abs(X[i + 1][1] - X[i][1]) + abs(X[i + 1][2] - X[i][2])) % 2 == 0 for i in range(N)) else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []

for _ in range(N):
  lst.append(list(map(int, input().split())))

for l in lst:
  if l[0] % 2 != (abs(l[1]) + abs(l[2])) % 2 or (abs(l[1]) + abs(l[2])) > l[0]:
    print("NO")
    exit()

print("YES")

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []

for _ in range(N):
  lst.append(list(map(int, input().split())))

for l in lst:
  if l[0] % 2 != (l[1] + l[2]) % 2 or (abs(l[1]) + abs(l[2])) > l[0]:
    print("NO")
    exit()

print("YES")

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []

for _ in range(N):
  lst.append(list(map(int, input().split())))

for l in lst:
  if l[0] % 2 != (l[1] + l[2]) % 2:
    print("NO")
    exit()

print("YES")

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
key_dict = {}

for i in range(n):
  t, x, y = (int(i) for i in input().split())
  key_dict[str(t)] = { 'x': x, 'y': y }
  
for index, value in key_dict.items():
  # Even Case
  i = int(index)
  if i % 2 == 0 and (value['x'] + value['y']) % 2 == 0:
    if i < value['x'] or i < value['y']:
      print('No')
  elif i % 2 == 1 and (value['x'] + value['y']) % 2 == 1:
    if i < value['x'] or i < value['y']:
      print('No')
  else:
    print('No')
    sys.exit()
    
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t,x,y = map(int , input().split())
if x+y>t or (x+y+t)%2 !=0:
	print('No')
	exit()
for i in range(n-1):
	t_i,x_i,y_i = map(int , input().split())
	e=abs(x-x_i)+abs(y-y_i)+t_i-t
	if e>0  or e%2 !=0:
		print('No')
		exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t,x,y = map(int , input().split())
if x+y>t or (x+y+t)%2 !=0:
	print('No')
	exit()
for i in range(n-1):
	t_i,x_i,y_i = map(int , input().split())
	e=abs(x-x_i)+abs(y-y_i)+t_i-t
	if e<0  or e%2 !=0:
		print('No')
		exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t,x,y =(0, 0, 0)
for _ in range(n):
    nt, nx, ny =map(int,input().split())
    dis=abs(nx-x)+abs(ny-y)
    tim = nt - t
    print(dis,tim)
    if tim >= dis and (tim - dis) % 2 ==0:
        t,x,y=nt, nx, ny
    else:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[list(map(int,input().split()))for i in range(n)]
dt=[]
dist=[]
for i in range(n-1):
    dt.append(t[i+1][0]-t[i][0])
    dist.append(abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2]))
for  i,j in zip(dt,dist):
    if i<j:
        print("No")
        exit()
    if i%2==0 and j%2==0:
        continue
    elif i%2!=0 and j%2!=0:
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[list(map(int,input().split()))for i in range(n)]
dt=[]
dist=[]
for i in range(n-1):
    dt.append(t[i+1][0]-t[i][0])
    dist.append(abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2]))
for  i,j in zip(dt,dist):
    if dt<dist:
        print("No")
        exit()
    if i%2==0 and j%2==0:
        continue
    elif i%2!=0 and j%2!=0:
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[list(map(int,input().split()))for i in range(n)]
dt=[]
dist=[]
for i in range(n-1):
    dt.append(t[i+1][0]-t[i][0])
    dist.append(abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2]))
for  i,j in zip(dt,dist):
    if i%2==0 and j%2==0:
        continue
    elif i%2!=0 and j%2!=0:
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
X = [list(map(int, input().split())) for l in range(N)]

## N < 1e5 なので普通にfor文で回してみる
lst_bool = []
for i in range(N-1):
  dt = X[i+1][0] - X[i][0]
  dx = X[i+1][1] - X[i][1]
  dy = X[i+1][2] - X[i][2]
  dl = abs(dx) + abs(dy)
  bool_1 = (dt >= dl)
  bool_2 = ((dt - dl) % 2 == 0)
  lst_bool.append(bool_1 and bool_2)

if all(lst_bool):
  print('Yes')
else:
  print('No')




#X = np.array(X)
#var = np.roll(X, -1, axis=0) - X
#print(var)

Submission status: Wrong Answer

Solution code:
N=int(input())
t=[0]*N
x=[0]*N
y=[0]*N
for i in range(N):
  t[i],x[i],y[i]=map(int,input().split())
  
def traveling(t,x,y):
  time_i=0
  x_i=0
  y_i=0
  for i,time in enumerate(t):
    time_i=time-time_i
    x_i=x[i]-x_i
    y_i=y[i]-y_i
    z=x_i+y_i
    if (time_i-z)%2!=0:
      return "No"
    time_i=time
    x_i=x[i]
    y_i=y[i]
  return "Yes"
    
print("{}".format(traveling(t,x,y)))

Submission status: Wrong Answer

Solution code:
N=int(input())
t=[0]*N
x=[0]*N
y=[0]*N
for i in range(N):
  t[i],x[i],y[i]=map(int,input().split())
  
def traveling(t,x,y):
  time_i=0
  x_i=0
  y_i=0
  for i,time in enumerate(t):
    time_i=time-time_i
    x_i=x[i]-x_i
    y_i=y[i]-y_i
    z=x[i]+y[i]
    if (time_i-z)%2==0:
      return "Yes"
    else:
      return "No"
    time_i=time
    x_i=x[i]
    y_i=y[i]
    
print("{}".format(traveling(t,x,y)))

Submission status: Wrong Answer

Solution code:
N=int(input())
t=[0]*N
x=[0]*N
y=[0]*N
for i in range(N):
  t[i],x[i],y[i]=map(int,input().split())
  
def traveling(t,x,y):
  time_i=0
  for i,time in enumerate(t):
    time_i=time-time_i
    z=x[i]+y[i]
    if (time_i-z)%2==0:
      return "Yes"
    else:
      return "No"
    time_i=time
    
print("{}".format(traveling(t,x,y)))

Submission status: Wrong Answer

Solution code:
N = int(input())
manhat = lambda x,y:abs(x[0]-y[0])+abs(x[1]-y[1])
flag = True
t_,x_,y_ = 0,0,0
for i in range(N):
  t,x,y = map(int, input().split())
  dt = t-t_
  dx = manhat((x,y), (x_,y_))
  if dt < dx or (dt - dx) % 2:
    flag = False
    break
  t_,x_,y_ = t,x,y

print('YES' if flag else 'NO')

Submission status: Wrong Answer

Solution code:
N = int(input())

t,x,y = [0] * N, [0] * N, [0] * N
for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())

can = "Yes"
for j in range(N-1):
    dt = t[j+1] - t[j]
    dr = abs(x[j+1]-x[j]) + abs(y[j+1] - y[j])

    if (dt < dr) | (dr % 2 != dt % 2):
        can = "No"
        break
    
print(can)

Submission status: Wrong Answer

Solution code:
N = int(input())  # 1行目のNを取得する
Plan = [list(map(int, input().split())) for i in range(N)]  # 複数行の数値の入力を取得

# マス目が白か黒か判定する
def checkCel(x, y):
    if x % 2 == 0:
        if y % 2 == 0:  # 偶、偶
            return "Black"
        else:  # 偶、奇
            return "White"

    else:
        if y % 2 == 0:  # 奇、偶
            return "White"
        else:  # 奇,奇
            return "Black"


OKNG = 'Yes'
for i in range(0, len(Plan)):

    if Plan[i][1] + Plan[i][2] < Plan[i][0] + 1:

        cel = checkCel(Plan[i][1], Plan[i][2])

        if (Plan[i][0] % 2 == 0 and cel == "Black") or \
                (Plan[i][0] % 2 == 1 and cel == "White"):
            break
        else:
            OKNG = 'No'
    else:
        OKNG = 'No'

print(OKNG)

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [[0,0,0]]+[[int(x) for x in input().split()] for _ in range(N)]
flag = True

for ind,i in enumerate(t[1:]):
    dist = i[0]-t[ind][0]-(sum(i[1:])-sum(t[ind][1:]))
    if(dist==0):
        pass
    elif(dist>0):
        if(dist%2==0):
            pass
        elif(i[1]!=t[ind][1] or i[2]!=t[ind][2]):
            pass
        else:
            flag = False
            break
    else:
        flag = False
        break
if(flag):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [[0,0,0]]+[[int(x) for x in input().split()] for _ in range(N)]
flag = True

for ind,i in enumerate(t[1:]):
    dist = i[0]-t[ind][0]-(sum(i[1:])-sum(t[ind][1:]))
    if(dist==0):
        pass
    elif(dist>0):
        if(dist%2==0):
            pass
        elif(i[1]!=t[ind][1] and i[2]!=t[ind][2]):
            pass
        else:
            flag = False
            break
    else:
        flag = False
        break
if(flag):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
a= [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x:x[0])
t,x,y=0,0,0
for i in a:
    t=i[0]-t
    l=abs(x-i[1])+abs(y-i[2])
    x=i[1]
    y=i[2]
    if(t>=l and (t-l)%2==0):
        continue
    else:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
previous_t = 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    print(t)
    print(x)
    print(y)
    if x + y > t:
        print("No")
        break
    if (x + y) % 2 != t % 2:
        print("No")
        break
    if previous_t > 0 and (abs(x - previous_x) + abs(y - previous_y) > (t - previous_t)):
        print("No")
        break
    previous_t = t
    previous_x = x
    previous_y = y
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
for i in range(N):
    K = list(map(int,input().split()))
    if K[0]>=K[1]+K[2] and K[0]%2==(K[1]+K[2])%2:
        count += 1
#print(count)   
if count == N:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
 
if li[0][0] - abs(li[0][1]) - abs(li[0][2]) < 0:
  print("NO")
  exit()
elif li[0][0] - abs(li[0][1]) - abs(li[0][2]) > 0:
  if (li[0][0] - abs(li[0][1]) - abs(li[0][2])) % 2 != 0:
    print("NO")
    exit()
else:
  for k in range(1,n):
    t = li[k][0]
    x = li[k][1]
    y = li[k][2]
    tt = li[k-1][0]
    xx = li[k-1][1]
    yy = li[k-1][2]
    if t - tt - abs(x - xx) - abs(y - yy) <0:
      print("NO")
      exit()
    elif t - tt - abs(x - xx) - abs(y - yy) <0:
      if (t - tt - abs(x - xx) - abs(y - yy)) % 2 != 0:
        print("NO")
        exit()
print("YES")

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-

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:
# -*- coding:utf-8 -*-

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("YES")
                exit()
print("NO")

Submission status: Wrong Answer

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

for i in range(1, n+1):
    t_diff = T[i] - T[i-1]
    pos_diff = abs(X[i] - X[i-1]) + abs(Y[i] - Y[i-1])
    if (pos_diff - t_diff) % 2 != 0:
        break
else:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

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

for i in range(1, n+1):
    t_diff = T[i] - T[i-1]
    pos_diff = abs(X[i] + Y[i] - X[i-1] - Y[i-1])
    if (pos_diff - t_diff) % 2 != 0:
        break
else:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
"""
可変長データの読み込み
"""
t = []
x = []
y = []

t.append(0)
x.append(0)
y.append(0)

for i in (range(0, 1000000, 1)):
  try:
    c = input()
    if i == 0:
      N = int(c)
    else:
      t.append(int(c.split(" ")[0]))
      x.append(int(c.split(" ")[1]))
      y.append(int(c.split(" ")[2]))
  except:
    break

for i in range(0, len(t) - 1, 1):
  
  con1 = t[i + 1] >= (x[i + 1] + y[i + 1]) 
  dt = t[i+1] - t[i]
  dist = (x[i+1]-x[i]) + (y[i+1] - y[i]) 
  
  print("{0} {1} {2}".format(con1, dist, dt))
  
  if con1 is True and (dt - dist) %2 == 0:
    ans  = "Yes"
  else:
    ans = "No"
    break
    
print(ans)

Submission status: Wrong Answer

Solution code:
"""
可変長データの読み込み
"""
t = []
x = []
y = []

t.append(0)
x.append(0)
y.append(0)

for i in (range(0, 1000000, 1)):
  try:
    c = input()
    if i == 0:
      N = int(c)
    else:
      t.append(int(c.split(" ")[0]))
      x.append(int(c.split(" ")[1]))
      y.append(int(c.split(" ")[2]))
  except:
    break

for i in range(0, len(t) - 1, 1):
  
  con1 = t[i + 1] >= (x[i + 1] + y[i + 1]) 
  dt = t[i+1] - t[i]
  dist = (x[i+1]-x[i]) + (y[i+1] - y[i]) 
  
  print("{0} {1} {2}".format(con1, dist, dt))
  
  if con1 is True and (dt - dist) %2 == 0:
    print("Yes")
  else:
    print("No")
    break

Submission status: Wrong Answer

Solution code:
"""
可変長データの読み込み
"""
t = []
x = []
y = []

t.append(0)
x.append(0)
y.append(0)

for i in (range(0, 1000000, 1)):
  try:
    c = input()
    if i == 0:
      N = int(c)
    else:
      t.append(int(c.split(" ")[0]))
      x.append(int(c.split(" ")[1]))
      y.append(int(c.split(" ")[2]))
  except:
    break

for i in range(0, len(t) - 1, 1):
  
  con1 = t[i + 1] >= (x[i + 1] + y[i + 1]) 
  dt = t[i+1] - t[i]
  dist = (x[i+1]-x[i]) + (y[i+1] - y[i]) 
  
  print("{0} {1} {2}".format(con1, dist, dt))
  
  if con1 is True and (dt - dist) %2 == 0:
    print("yes")
  else:
    print("No")
    break

Submission status: Wrong Answer

Solution code:
def check(x, y, new_x, new_y, dt):
  diff = abs(new_x - x) + abs(new_y - y)
  if dt%2 == diff%2 and diff <= dt:
    return True
  return False

n = int(input())
t, x, y, count = 0, 0, 0, 0
canReach = True
while(count < n):
  new_t, new_x, new_y = map(int, input().split())
  if not check(x, y, new_x, new_y, new_t-t):
    canReach = False
    break
  t, x, y = new_t, new_x, new_y
  count += 1
if canReach:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    l = [[int(s) for s in input().split()] for n in range(N)]
    can = True
    now = [0, 0, 0]
    for i in range(N):
        pos = l[i]
        d = abs(pos[1] - now[1]) + abs(pos[2] - now[2])
        t = pos[0] - now[0]
        if d % 2 != t % 2 or d > t:
            can = False
        now = pos
    if can:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    l = [[int(s) for s in input().split()] for n in range(N)]
    can = True
    now = [0, 0, 0]
    for i in range(N):
        pos = l[i]
        d = abs(pos[1] - now[1]) + abs(pos[2] - now[2])
        t = pos[0] - now[0]
        if d % 2 != t % 2:
            can = False
        now = pos
    if can:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))

for i in range(N-1):
    t = data[i][0]
    x = data[i][1]
    y = data[i][2]
    deltaT = data[i+1][0] - t
    absX = abs(data[i+1][1] - x)
    absY = abs(data[i+1][2] - y)
    prob = deltaT - absX - absY
    if prob < 0 or prob % 2 != 0:
        print("No")
        quit()
print("Yes")

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import copy

class State():
    def __init__(self):
        self.t = 0
        self.pos = [0,0]

def search(player,plan):
    t = plan.t - player.t

    # print("player t:",player.t,", pos:",player.pos)
    # print("plan t:",plan.t,", pos:",plan.pos)
    # print("t: ",t)

    trials = []
    for i in range(t+1):
        for j in range(t+1-i):
            for k in range(t+1-i-j):
                l=t-i-j-k
                trial = [i,j,k,l]
                trials.append(trial)

    for trial in trials:
        tmp_pos = copy.deepcopy(player.pos)
        for i in range(trial[0]):
            tmp_pos[0] += 1
        for i in range(trial[1]):
            tmp_pos[0] -= 1
        for i in range(trial[2]):
            tmp_pos[1] += 1
        for i in range(trial[3]):
            tmp_pos[1] -= 1

        if tmp_pos == plan.pos:
            return True

    return False


if __name__ == '__main__':
    N = input()
    N = int(N)
    plans = []
    for i in range(N):
        plan = State()
        inData = input()
        t = int(inData.split()[0])
        x = int(inData.split()[1])
        y = int(inData.split()[2])
        plan.t = t
        plan.pos = [x,y]
        plans.append(plan)

    player = State()
    for plan in plans:
        if search(player,plan):
            player.t = plan.t
            player.pos = copy.deepcopy(plan.pos)
        else:
            print("NO")
            break
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
t_sub = []
x_sub = []
y_sub = []
for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())
for i in range(N-1):
    t_sub.append(t[i+1]-t[i])
    x_sub.append(x[i+1]-x[i])
    y_sub.append(y[i+1]-y[i])
flg = False
d = [0]*(N-1)
for i in range(N-1):
    d[i] = abs(x_sub[i])+abs(y_sub[i])
    if t_sub[i] >= d[i] and t_sub[i]%2 == d[i]%2:
        flg = True
    else:
        flg = False
        break
if flg:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
t_sub = []
x_sub = []
y_sub = []
for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())
for i in range(N-1):
    t_sub.append(t[i+1]-t[i])
    x_sub.append(x[i+1]-x[i])
    y_sub.append(y[i+1]-y[i])
flg = False
d = [0]*(N-1)
for i in range(N-1):
    d[i] = abs(x_sub[i])+abs(y_sub[i])
    if t_sub[i] >= d[i] and t_sub[i]%2 == d[i]%2:
        flg = True
    else:
        flg = False
if flg:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
t_sub = []
x_sub = []
y_sub = []
for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())
if t[0] < x[0] + y[0]:
    print('No')
    exit()
else:
    for i in range(N-1):
        t_sub.append(t[i+1]-t[i])
        x_sub.append(x[i+1]-x[i])
        y_sub.append(y[i+1]-y[i])
flg = False
d = [0]*(N-1)
for i in range(N-1):
    d[i] = abs(x_sub[i])+abs(y_sub[i])
    if t_sub[i] >= d[i] and t_sub[i]%2 == d[i]%2:
        flg = True
    else:
        flg = False
if flg:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
c=1
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
while c<n+1:
    a,b,d=(int(x) for x in input().split())
    t[c]=a
    x[c]=b
    y[c]=d
    c=c+1
c=1
kotae=0
while c<n+1:
    time=t[c]-t[c-1]
    kyori=x[c]-x[-1]+y[c]-y[c-1]
    if time>kyori:
        if time%2==kyori%2:
            kotae=1
        else:
            kotae=2
    else:
        kotae=2
    c=c+1
if kotae==1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
t = []
x = []
y = []
N = int(input())
s = []

for i in range(N):
    t1, x1, y1 = [int(i) for i in input().split()]
    t.append(t1)
    x.append(x1)
    y.append(y1)

for i in range(N):
    if i == 0 and t[i] < abs(x[i]) + abs(y[i]):
        s.append(0)
    elif i > 0 and t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        s.append(0)
    else:
        if (t[i] % 2 == 1 and x[i] % 2 == 0 and y[i] % 2 == 0) or (t[i] % 2 == 1 and x[i] % 2 == 1 and y[i] % 2 == 1):
            s.append(0)
        elif (t[i] % 2 == 0 and x[i] % 2 == 1 and y[i] % 2 == 0) or (t[i] % 2 == 1 and x[i] % 2 == 0 and y[i] % 2 == 1):
            s.append(0)
        else:
            s.append(1)

for i in s:
    if i == 0:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
t = []
x = []
y = []
N = int(input())
s = []

for i in range(N):
    t1, x1, y1 = [int(i) for i in input().split()]
    t.append(t1)
    x.append(x1)
    y.append(y1)

for i in range(N):
    if i == 0 and t[i] < x[i] + y[i]:
        s.append(0)
    elif i > 0 and t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        s.append(0)
    else:
        if (t[i] % 2 == 1 and x[i] % 2 == 0 and y[i] % 2 == 0) or (t[i] % 2 == 1 and x[i] % 2 == 1 and y[i] % 2 == 1):
            s.append(0)
        elif (t[i] % 2 == 0 and x[i] % 2 == 1 and y[i] % 2 == 0) or (t[i] % 2 == 1 and x[i] % 2 == 0 and y[i] % 2 == 1):
            s.append(0)
        else:
            s.append(1)

for i in s:
    if i == 0:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
t = []
x = []
y = []
N = int(input())
s = []

for i in range(N):
    t1, x1, y1 = [int(i) for i in input().split()]
    t.append(t1)
    x.append(x1)
    y.append(y1)

for i in range(N):
    if t[i] < x[i] + y[i]:
        s.append(0)
    else:
        if (t[i] % 2 == 1 and x[i] % 2 == 0 and y[i] % 2 == 0) or (t[i] % 2 == 1 and x[i] % 2 == 1 and y[i] % 2 == 1):
            s.append(0)
        elif (t[i] % 2 == 0 and x[i] % 2 == 1 and y[i] % 2 == 0) or (t[i] % 2 == 1 and x[i] % 2 == 0 and y[i] % 2 == 1):
            s.append(0)
        else:
            s.append(1)

for i in s:
    if i == 0:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
t = []
x = []
y = []
N = int(input())
s = []

for i in range(N):
    t1, x1, y1 = [int(i) for i in input().split()]
    t.append(t1)
    x.append(x1)
    y.append(y1)

for i in range(N):
    if t[i] < x[i] + y[i]:
        s.append(0)
    else:
        if (t[i] % 2 == 1 and x[i] % 2 == 0 and y[i] % 2 == 0) or (t[i] % 2 == 1 and x[i] % 2 == 1 and y[i] % 2 == 1):
            s.append(0)
        elif (t[i] % 2 == 0 and x[i] % 2 == 1 and y[i] % 2 == 0) or (t[i] % 2 == 1 and x[i] % 2 == 0 and y[i] % 2 == 1):
            s.append(0)
        else:
            s.append(1)

for i in s:
    if i == 0:
        print("NO")
        break
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
N = int(input())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))

t, x, y = 0, 0, 0
for i in range(N):
    deltaT = data[i][0] - t
    absX = abs(data[i][1] - x)
    absY = abs(data[i][2] - y)
    prob = deltaT - absX - absY
    if not prob >= 0 and prob % 2 == 0:
        print("No")
        quit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))

t, x, y = 0, 0, 0
for i in range(N):
    deltaT = data[i][0] - t
    absX = abs(data[i][1] - x)
    absY = abs(data[i][2] - y)
    prob = deltaT - absX - absY
    if not prob >= 0 and prob % 2 == 0:
        print("NO")
        quit()
print("YES")

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(1, N+1):
    t[i], x[i], y[i] = map(int, input().split())
count = 0    
for j in range(1, N+1):
    if t[j]-t[j-1] < abs(x[j]-x[j-1]) + abs(y[j]-y[j-1]):
        print('No')
        count = 1
        break
    elif abs(x[j]-x[j-1]) + abs(y[j]-y[j-1]) == 0 and t[j]-t[j-1] % 2 != 0:
        print('No')
        count = 1
        break
    elif (abs(x[j]-x[j-1]) + abs(y[j]-y[j-1])) % 2 != t[j]-t[j-1] % 2:
        print('No')
        count = 1
        break
        
if count == 0:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(1, N+1):
    t[i], x[i], y[i] = map(int, input().split())
count = 0    
for j in range(1, N+1):
    if t[j]-t[j-1] < abs(x[j]-x[j-1]) + abs(y[j]-y[j-1]):
        print('No')
        count = 1
        break
    elif (abs(x[j]-x[j-1]) + abs(y[j]-y[j-1])) % 2 != t[j]-t[j-1] % 2:
        print('No')
        count = 1
        break
        
if count == 0:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(1, N+1):
    t[i], x[i], y[i] = map(int, input().split())
count = 0    
for j in range(1, N+1):
    if t[j]-t[j-1] < abs(x[j]-x[j-1]) + abs(y[j]-y[j-1]):
        print('No')
        count = 1
        break
    elif (abs(x[j]-x[j-1]) + abs(y[j]-y[j-1])) % 2 == t[j]-t[j-1] % 2:
        print('No')
        count = 1
        break
        
if count == 0:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(1, N+1):
    t[i], x[i], y[i] = map(int, input().split())
count = 0    
for j in range(1, N+1):
    if t[j]-t[j-1] < abs(x[j]-x[j-1]) + abs(y[j]-y[j-1]):
        print('No')
        count = 1
        break
    elif abs(x[j]-x[j-1]) + abs(y[j]-y[j-1]) == 0 and t[j]-t[j-1] % 2 != 0:
        print('No')
        count = 1
        break
        
if count == 0:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input().split()[0])

txy_list = []

for i in range(0, n):
    work_list = list(map(int, input().split()))
    txy_list.append(work_list)

pre_txy = [0, 0, 0]
answer = False

for txy in txy_list:
    t, x, y = txy[0], txy[1], txy[2]
    pre_t, pre_x, pre_y = pre_txy[0], pre_txy[1], pre_txy[2]

    t_w, x_w, y_w = t - pre_t, abs(x - pre_x), abs(y - pre_y)
    work = t_w - (x_w + y_w)

    if (work % 2 == 0) and (work >= 0):
        pre_txy = txy
        continue
    else:
        break
else:
    answer = True

a = 'YES' if answer else 'NO'
print(a)

Submission status: Wrong Answer

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

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")
    	break
    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")

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")
    else:
    	print("Yes")