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:
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(len(pos)):
  if i == 0:
    num = abs(pos[i][1]-0) + abs(pos[i][2]-0)
    if num <= pos[i][0] and pos[i][0] * (pos[i][0]%2) == num%2:
      pass
    else:
      print("No")
      sys.exit()     
  else:
    diff = pos[i][0]-pos[i-1][0]
    num = abs(pos[i][1]-pos[i-1][1]) + abs(pos[i][2]-pos[i-1][2])
    if num <= diff and diff * (diff%2) == num%2:
      pass
    else:
      print("No")
      sys.exit()      
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(len(pos)):
  if i == 0:
    if pos[i][1]+pos[i][2] != pos[i][0]:
      print("No")
      sys.exit()
  else:
    diff = pos[i][0]-pos[i-1][0]
    num = abs(pos[i][1]-pos[i-1][1]) + abs(pos[i][2]-pos[i-1][2])
    if num <= diff and diff * (diff%2) == num%2:
      pass
    else:
      print("No")
      sys.exit()      
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(len(pos)):
  if i == 0:
    if pos[i][1]+pos[i][2] != pos[i][0]:
      print("No")
      sys.exit()
  else:
    diff = pos[i][0]-pos[i-1][0]
    num = pos[i][1]+pos[i][2]
    if diff % 2 == 0:
      if 0 > num or num > diff:
        print("No")
        sys.exit()
    else:
      if 1 > num or num > diff:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

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



if N == 1:
    T = N
    SUM = x[0] + y[0]
    if T < SUM:
        print('No')
        exit()
    elif (T % 2 == 0 and SUM % 2 != 0) or (T % 2 != 0 and SUM % 2 == 0):
        print('No')
        exit()
    else:
        print('Yes')
        exit()
    

for i in range(N-1):
    T = t[i+1] - t[i]
    X = x[i+1] - x[i]
    Y = y[i+1] - y[i]
    

    
    
    if t[0] < x[0] + y[0]:
        print('No')
        exit()
    elif (t[0] % 2 == 0 and (x[0] + y[0]) % 2 != 0) or (t[0] % 2 != 0 and (x[0] + y[0]) % 2 == 0):
        print('No')
        exit()
    

    SUM = X + Y

    if T < SUM:
        print('No')
        exit()
    elif (T % 2 == 0 and SUM % 2 != 0) or (T % 2 != 0 and SUM % 2 == 0):
        print('No')
        exit()
    else:
        continue
    
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())

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



if N == 1:
    T = N
    SUM = x[0] + y[0]
    if T < SUM:
        print('No')
        exit()
    elif (T % 2 == 0 and SUM % 2 != 0) or (T % 2 != 0 and SUM % 2 == 0):
        print('No')
        exit()
    else:
        print('Yes')
        exit()
    

for i in range(N-1):
    T = t[i+1] - t[i]
    X = x[i+1] - x[i]
    Y = y[i+1] - y[i]
    SUM = x[0] + y[0]
    
    if t[0] < SUM:
        print('No')
        exit()
    elif (t[0] % 2 == 0 and SUM % 2 != 0) or (t[0] % 2 != 0 and SUM % 2 == 0):
        print('No')
        exit()
    else:
        continue

    SUM = X + Y
    if T < SUM:
        print('No')
        exit()
    elif (T % 2 == 0 and SUM % 2 != 0) or (T % 2 != 0 and SUM % 2 == 0):
        print('No')
        exit()
    else:
        continue
    
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())

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


if N == 1:
    T = N
    SUM = x[0] + y[0]
    if T < SUM:
        print('No')
        exit()
    elif (T % 2 == 0 and SUM % 2 != 0) or (T % 2 != 0 and SUM % 2 == 0):
        print('No')
        exit()
    else:
        print('Yes')
        exit()
    

for i in range(N):
    T = t[i+1] - t[i]
    X = x[i+1] - x[i]
    Y = y[i+1] - y[i]

    SUM = X + Y
    if T < SUM:
        print('No')
        exit()
    elif (T % 2 == 0 and SUM % 2 != 0) or (T % 2 != 0 and SUM % 2 == 0):
        print('No')
        exit()
    else:
        print('Yes')
        exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
P = [[0,0,0]]
for i in range(N):
    t,x,y = map(int,input().split())
    P.append([t,x,y])
judge = False
for i in range(1,N+1):
    dt = P[i][0] - P[i-1][0]
    dist = abs(P[i][1] - P[i-1][1]) + abs(P[i][2] - P[i-1][2])
    if (dt % 2 == 0 and dist % 2 == 0 and dist <= dt) or (dt % 2 == 1 and dist % 2 == 1 and dist <= dt):
        judge = True
if judge:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
P = [[0,0,0]]
for i in range(N):
    t,x,y = map(int,input().split())
    P.append([t,x,y])
judge = False
for i in range(1,N+1):
    dt = P[i][0] - P[i-1][0]
    dist = abs(P[i][1] - P[i-1][1]) + abs(P[i][2] - P[i-1][2])
    if (dt % 2 == 0 and dist % 2 == 0) or (dt % 2 == 1 and dist % 2 == 1):
        judge = True
if judge:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
P = []
for i in range(N):
    t,x,y = map(int,input().split())
    P.append([t,x,y])

def judge(t,x,y):
    if t % 2:#tが奇数
        if abs(x + y) % 2 == 1 and abs(x + y) <= t:
            return True
        else:
            return False
    else:#tが偶数
        if abs(x + y) %2 == 0 and abs(x + y) <= t:
            return True
        else:
            return False

for p in P:
    if judge(p[0],p[1],p[2]) == False:
        print("No")
        exit()


print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
P = []
for i in range(N):
    t,x,y = map(int,input().split())
    P.append([t,x,y])

def judge(t,x,y):
    if t % 2:#tが奇数
        if (x + y) % 2 == 1 and (x + y) <= t:
            return True
        else:
            return False
    else:#tが偶数
        if (x + y) %2 == 0 and (x + y) <= t:
            return True
        else:
            return False

for p in P:
    if judge(p[0],p[1],p[2]) == False:
        print("No")
        exit()


print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
P = []
for i in range(N):
    t,x,y = map(int,input().split())
    P.append([t,x,y])

def judge(t,x,y):
    if t % 2:#tが奇数
        if (x + y) % 2:
            return True
        else:
            return False
    else:#tが偶数
        if (x + y) %2:
            return False
        else:
            return True

for p in P:
    if judge(p[0],p[1],p[2]) == False:
        print("No")
        exit()


print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
pt, px, py = 0, 0, 0
can = True
for i in range(N):
    t, x, y = map(int, input().split())
    T, X, Y = t - pt, abs(x - px), abs(y - py)
    if T < X + Y or T % 2 != (X + Y) % 2:
        can = False
print('Yes' if can else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())

locx = 0
locy =0
time = 0
for i in range(N):
  t,x,y = map(int,input().split())
  time = t-time
  dis = abs(locx-x)+abs(locy-y)
  if (time-dis)<0 :
    print("No")
    exit()
  if (time-dis)%2 == 1:
    print("No")
    exit()
    
  
  
  locx = x
  locy = y
    
  
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

loc = [0,0]
time = 0
for i in range(N):
  t,x,y = map(int,input().split())
  time = t-time
  dis = abs(loc[0]-x)+abs(loc[1]-y)
  if (time-dis)<0 :
    print("No")
    exit()
  if (time-dis)%2 == 1:
    print("No")
    exit()
    
  
  
  loc = [x,y]
    
  
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t0, x0, y0 = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    kyori = abs(x - x0) + abs(y - y0)
    time = abs(t0 - t)
    if abs(kyori - time) % 2 == 0 and kyori - time < 0:
        t0, x0, y0 = t, x, y
    else:
        print('No')
        exit(0)
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())

loc = [0,0]
time = 0
for i in range(N):
  t,x,y = map(int,input().split())
  time = t-time
  dis = abs(loc[0]-x)+abs(loc[1]-y)
  if (time-dis)<0 :
    print("No")
    exit()
  elif (time-dis)%2 == 1:
    print("No")
    exit()
    
  else :
    loc = [x,y]
    
  
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    if t:
      xy.append(t)
    else :
      break
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    exit()
  elif (time-dis)%2 == 1:
    print("No")
    exit()
    
  else :
    loc = [a[1],a[2]]
    
  
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    exit()
  elif (time-dis)%2 == 1:
    print("No")
    exit()
    
    
  else :
    loc = [a[1],a[2]]
    
  
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    exit()
  elif (time-dis)%2 == 0:
    loc = [a[1],a[2]]
    
  else :
    print("No")
    exit()
  
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    break
  elif (time-dis)%2 == 0:
    pass
    
  else :
    print("No")
    break
  loc = [a[1],a[2]]
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  print(time)
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    break
  elif (time-dis)%2 == 0:
    pass
    
  else :
    print("No")
    break
  loc = [a[1],a[2]]
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
T = []
XY = []


def f(x1, y1, x2, y2):
    return abs(x1 - x2) + abs(y1 - y2)


print('No')
exit()

cx, cy = 0, 0
ct = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    d = f(cx, cy, x, y)
    if d > t - ct:
        print('No')
        exit()
    if (t - ct - d) % 2 != 0:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
T = []
XY = []


def f(x1, y1, x2, y2):
    return abs(x1 - x2) + abs(y1 - y2)


cx, cy = 0, 0
ct = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    d = f(cx, cy, x, y)
    if d > t - ct:
        print('No')
        exit()
    if (t - ct - d) % 2 != 0:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    break
  elif (time-dis)%2 == 0:
    loc = [a[1],a[2]]
    
  else :
    print("No")
    break
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    break
  elif time%2 == dis%2:
    loc = [a[1],a[2]]
    
  else :
    print("No")
    break
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0] -time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    break
  elif (time-dis)%2 == 0:
    loc = [a[1],a[2]]
  else :
    print("No")
    break
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
for i in range(N):
  a = xy[i]
  time = a[0]
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    break
  elif (time-dis)%2 == 0:
    loc = [a[1],a[2]]
  else :
    print("No")
    break
else :
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

T = 0
X = 0
Y = 0

for i in range(N):
    t, x, y = map(int, input().split())
    dt = t - T
    dx = abs(X - x)
    dy = abs(Y - y)
    dis = dx + dy
    if dt < dis:
        print("No")
        break
    if (dt - dis) % 2 == 1:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
bx=by=0
ans='Yes'

for i in range(n):
    t,x,y=map(int, input().split())
    if t%2!=(x+y)%2:
        ans='No'
    if abs(bx-x)+abs(by-y)>t:
        ans='No'
    bx=x
    by=y

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = z()
T, X, Y = [], [], []
pos_x, pos_y, now_t = 0, 0, 0
for i in range(N):
    t, x, y = zz()
    T.append(t)
    X.append(x)
    Y.append(y)
ok = 1
for t, x, y in zip(T, X, Y):
    if (abs(x - pos_x) + abs(y - pos_y) > (t - now_t)):
        ok = 0
        break
    if ((abs(x - pos_x) + abs(y - pos_y) % 2) != ((t - now_t) % 2)):
        ok = 0
        break
    pos_x, pos_y, now_t = x, y, t
if(ok == 1):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = z()
T, X, Y = [], [], []
pos_x, pos_y, now_t = 0, 0, 0
for i in range(N):
    t, x, y = zz()
    T.append(t)
    X.append(x)
    Y.append(y)
for t, x, y in zip(T, X, Y):
    if (abs(x - pos_x) + abs(y - pos_y) > (t - now_t)):
        print('No')
        exit()
    if ((abs(x - pos_x) + abs(y - pos_y) % 2) != ((t - now_t) % 2)):
        print('No')
        exit()
    pos_x, pos_y, now_t = x, y, t
print('Yes')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = z()
T, X, Y = [], [], []
pos_x, pos_y, now_t = 0, 0, 0
for i in range(N):
    t, x, y = zz()

    T.append(t)
    X.append(x)
    Y.append(y)
for t, x, y in zip(T, X, Y):
    if (abs(x - pos_x) + abs(y - pos_y) > (t - now_t)):
        print('No')
        exit()
    if(abs(x - pos_x)+abs(y - pos_y) % 2 != (t - now_t) % 2):
        print('No')
        exit()
    pos_x, pos_y, now_t = x, y, t
print('Yes')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
infos = []
for i in range(N):
  infos.append([int(s) for s in input().split()])

def check():
    c_t = 0
    c_x = 0
    c_y = 0
    for info in infos:
      n_t = info[0]
      n_x = info[1]
      n_y = info[2]

      d_t = n_t - c_t
      d_x = n_x - c_x
      d_y = n_y - c_y
      if d_t < (d_x + d_y):
        return "No"

      if d_t % 2 != (d_x+d_y) % 2:
        return "No"
      c_t = n_t
      c_x = n_x
      c_y = n_y
    return "Yes"

print(check())

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
infos = []
for i in range(N):
  infos.append([int(s) for s in input().split()])

def check():
    c_t = 0
    c_x = 0
    c_y = 0
    for info in infos:
      n_t = info[0]
      n_x = info[1]
      n_y = info[2]

      d_t = n_t - c_t
      d_x = n_x - c_x
      d_y = n_y - c_y
      if d_t < (d_x + d_y):
        return "No"

      if (d_t - (d_x+d_y)) % 2 != 0:
        return "No"
      c_t = n_t
      c_x = n_x
      c_y = n_y
    return "Yes"

print(check())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#13 C - Traveling
N = int(input())

plan = []
for _ in range(N):
    ti,xi,yi = map(int,input().split())
    plan.append((ti,xi,yi))
    
#今いる場所の座標と時間
spot = (0,0,0)
result = 'Yes'
for t,x,y in plan:
    tdiff = t-spot[0]
    xdiff = abs(x-spot[1])
    ydiff = abs(y-spot[2])
    #(x,y)の変化量の和の偶奇と時間の差の偶奇が一致している
    #時間の変化量より(x,y)の変化量の方が小さい
    if (tdiff%2 == (xdiff+ydiff)%2) and (xdiff<=tdiff) and (ydiff<=tdiff):
        spot = (t,x,y)
    else:
        result = 'No'
        break
print(result)

Submission status: Wrong Answer

Solution code:
#13 C - Traveling
N = int(input())

plan = []
for _ in range(N):
    ti,xi,yi = map(int,input().split())
    plan.append((ti,xi,yi))

spot = (0,0,0)
result = 'Yes'
for t,x,y in plan:
    if ((t-spot[0])%2 == (abs(x-spot[1])+abs(y-spot[2]))%2) and ((x-spot[1])<=(t-spot[0])) and ((y-spot[2])<=(t-spot[0])):
        spot = (t,x,y)
    else:
        result = 'No'
        break
print(result)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding=utf-8

import sys

n = int(sys.stdin.readline().strip())

txy = [tuple(map(int, l.strip().split(" "))) for l in sys.stdin.readlines()]
check_txy = [abs(_x) + abs(_y) <= _t and (_t + _x + _y) % 2 == 0 for (_t, _x, _y) in txy]
if all(check_txy):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def solve(string):

    n, *txy = map(int, string.split())
    checks = [
        abs(x) + abs(y) <= t and (t + x + y) % 2 == 0
        for t, x, y in zip(txy[::3], txy[1::3], txy[2::3])
    ]
    return "Yes" if all(checks) else "No"


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(n)])))

Submission status: Wrong Answer

Solution code:
N = int(input())
l = [list(map(int,input().split())) for i in range(N)]
l.insert(0,[0,0,0])
def check(pre,next):
  dt = next[0] - pre[0]
  dx = next[1] - pre[1]
  dy = next[2] - pre[2]
  
  for x in range(dt + 1):
    # +1方向がx回なら、−1方向はx-dx回
    if x + x - dx > dt or x - dx < 0:
      continue
    for y in range(dt - (x + x - dx) + 1):
      if y - dy < 0:
        continue
      if x + x - dx + y + y - dy == dt:
        return True
  return False

for n in range(N):
  if not check(l[n],l[n+1]):
    print('NO')
    break
else:
  print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
t = 0
dx = 0
dy = 0
z = 'Yes'
for i,h,j in txy:
    if dx == h and dy == j:
        z = 'No'
        break
    else:
        if abs(dx-h)+abs(dy-j) == i-t:
            dx = h
            dy = j
            t = i
        else:
            z = 'No'
            break
print(z)

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int,input().split())) for _ in range(n)]
t = txy[0][0]
go = txy[0][1] + txy[0][2]
if t < go or t%2 != go%2:
    print("No")
    exit()
for i in range(n-1):
    t = txy[i+1][0] - txy[i][0]
    go = txy[i+1][1] + txy[i+1][2] - txy[i][1] - txy[i][2]
    if t < go or t%2 != go%2:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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

def func(n, pos):
    c_t, c_x, c_y = 0, 0, 0

    for i in pos:
        d_t = i[0] - c_t
        z = (i[1] - c_x) + (i[2] - c_y)

        if z > d_t or (d_t - z) % 2 != 0:
            return "No"
        else:
            c_t, c_x, c_y = i[0], i[1], i[2]

    return "Yes"


print(func(n, pos))

Submission status: Wrong Answer

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

def func(n, pos):
    c_t, c_x, c_y = 0, 0, 0

    for i in pos:
        d_t = i[0] - c_t
        z = abs(i[1] - c_x) + abs(i[2] - c_y)

        if z > d_t or (d_t - z) % 2 != 0:
            return "No"
        else:
            c_t, c_x, c_y = 0, 0, 0

    return "Yes"


print(func(n, pos))

Submission status: Wrong Answer

Solution code:
n = int(input())
tl = []
dl = []
flag = 0

for i in range(n):
    t, x, y = (int(x) for x in input().split())
    tl.append(t)
    dl.append((x, y))

for num in range(n):
    if tl[num] >= sum(dl[num]) and tl[num]%2 == sum(dl[num])%2:
        pass
    else:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
for _ in range(N):
    t,x,y = map(int, input().split())
    if (t+x+y)%2 or t<(x+y):
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [];X = [];Y = []
for _ in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)
if N == 1:
    print('Yes' if T[0] == sum(X+Y) else 'No')
    exit()
for i in range(N):
    d = abs(X[i] + Y[i] - X[i-1] - Y[i-1])
    t = T[i] - T[i-1]
    if t >= d:
        t = t % 2
        d = d % 2
        if (t != 0 and d == 0) or (t == 0 and d != 0):
            print('No')
            exit()
    else:
        print('No')
        exit()
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N=input()
a=[]
t=True
for _ in range(int(N)):
    a+=[list(map(int,input().split()))]
for i in range(int(N)):
    if a[i][0]%2==0:
        if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:
            continue
        else:
            print('No')
            t=False
            break
    else:
        if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:
            continue
        else:
            print('No')
            t=False
            break
if t:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
t=[]
for i in range(n):
    t.append(list(map(int,input().split())))
for i,d in enumerate(t):
    if i>0:
        b=d[0]-a
        c=d[1]+d[2]-aa
    a=d[0]
    aa=d[1]+d[2]
    if i==0:
        if not (a >= aa and a % 2 == aa % 2):
            print('No')
            sys.exit()
        else:
            continue
    if not (b>=c and b%2==c%2):
        print('No')
        sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
t=[]
for i in range(n):
    t.append(list(map(int,input().split())))
for i,d in enumerate(t):
    if not (d[0]>=d[1]+d[2] and d[0]%2==(d[1]+d[2])%2):
        print('No')
        sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
num = int(input())
a = [list(map(int, input().split(' '))) for i in range(num)]
f = False

for i in range(num):
	c = a[i]
	d = a[i-1]
	if c[0] < c[1] + c[2]:
		f = False
		break
	elif i >= 1:
		if c[0] - d[0] < (c[1] + c[2] - d[1] - d[2]):
			f = False
			break
	else:
		if c[0]%2 == (c[1]+c[2])%2:
			f = True
		else:
			f = False
			break
if f:
	print('Yes')
if f == False:
	print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[list(map(int,input().split())) for _ in range(n)]
x=y=t=0
ans='Yes'
for i in range(n):
  xy=a[i][1]+a[i][2]-(x+y)
  if xy>a[i][0]-t:
    ans='No'
    break
  else:
    if xy%2!=(a[i][0]-t)%2:
      ans='No'
      break
  x=a[i][1]
  y=a[i][2]
  t=a[i][0]
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[list(map(int,input().split())) for _ in range(n)]
x=y=t=0
ans='Yes'
for i in range(n):
  xy=a[i][1]+a[i][2]-(x+y)
  if xy>a[i][0]-t:
    ans='No'
    break
  else:
    if xy%2!=(a[i][0]-t)%2:
      ans='No'
      break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
t = 0
dx = 0
dy = 0
z = 'Yes'
for i,h,j in txy:
    if (dx != h or dy != j) and abs(dx-h)+abs(dy-j) <= i-t:
        dx = h
        dy = j
        t = i
    else:
        z = 'No'
print(z)

Submission status: Wrong Answer

Solution code:
n=int(input())
x,y=0,0
t=0
for i in range(n):
    X,Y,T=map(int,input().split())
    if((T-t)>=(abs(X-x)+abs(Y-y)) and (T-t)%2==(abs(x-X)+abs(Y-y))%2):
        x=X
        y=Y
        t=T
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
x,y=0,0
t=0
for i in range(n):
    X,Y,T=map(int,input().split())
    if((T-t)>=(abs(X-x)+abs(Y-y)) and abs(t-T)%2==(abs(x-X)+abs(Y-y))%2):
        x=X
        y=Y
        t=T
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
x,y=0,0
t=0
for i in range(n):
    X,Y,T=map(int,input().split())
    if((T-t)>=(abs(X-x)+abs(Y-y)) and abs(t-T)%2==(abs(x-X)+abs(Y-x))%2):
        x=X
        y=Y
        t=T
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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

def func(n, pos):
    c_t, c_x, c_y = 0, 0, 0

    for i in pos:
        d_t = i[0] - c_t
        z = (i[1] - c_x) + (i[2] - c_y)

        if z > d_t or (d_t - z) % 2 != 0:
            return "No"
        else:
            c_t, c_x, c_y = 0, 0, 0

    return "Yes"


print(func(n, pos))

Submission status: Wrong Answer

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

ans = 'Yes'
for i in range(1,N+1):
    dist = (txy[i][1]-txy[i-1][1])+(txy[i][2]-txy[i-1][2])
    dt   = txy[i][0]-txy[i-1][0]
    
    if dist%2 != dt%2 or dist>dt:
        ans = 'No'
        
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-2:
    a = T[i] 
    b = T[i]
    i += 1        
print(flag)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-2:
    t1,x1,y1 = T[i] 
    i += 1        
print(flag)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-2:
    t1,x1,y1 = T[i] 
#     t2,x2,y2 = T[i+1]
#     t2,x2,y2 = T[i]
#     dis = abs(x2-x1)+abs(y2-y1)
#     _t = t2-t1
#     if dis > _t or _t%2 != dis%2:
#         flag = 'No'
    i += 1        
print(flag)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
#     t2,x2,y2 = T[i+1]
#     dis = abs(x2-x1)+abs(y2-y1)
#     _t = t2-t1
#     if dis > _t or _t%2 != dis%2:
#         flag = 'No'
    i += 1        
print(flag)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
#     t1,x1,y1 = T[i] 
#     t2,x2,y2 = T[i+1]
#     dis = abs(x2-x1)+abs(y2-y1)
#     _t = t2-t1
#     if dis > _t or _t%2 != dis%2:
#         flag = 'No'
    i += 1        
print(flag)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
# while flag=='Yes' and i<len(T)-1:
#     t1,x1,y1 = T[i] 
#     t2,x2,y2 = T[i+1]
#     dis = abs(x2-x1)+abs(y2-y1)
#     _t = t2-t1
#     if dis > _t or _t%2 != dis%2:
#         flag = 'No'
#     i += 1        
print(flag)

Submission status: Wrong Answer

Solution code:
N = int(input())

t,x,y = 0,0,0
for _ in range(1, N+1):
    tn,xn,yn = map(int, input().split())
    step = abs(x-xn) + abs(y-yn)
    
    if  tn-t < step or (tn-t)%2 != step%2:
        print("No")
        break
    t,x,y = tn,xn,yn
    
print("Yes")

Submission status: Wrong Answer

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

for i in range(N):
    dt = T[i+1][0] - T[i][0]
    dxy = T[i+1][1] - T[i][1]

    if dt < dxy or dt % 2 != dxy % 2:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())+1
t,x,y,r=[0]*N,[0]*N,[0]*N,1
N-=1
for i in range(N):
    i+=1
    t[i],x[i],y[i]=map(int,input().split())

def isok(t,x,y):
    return (x+y<=t)*(1-(x+y-t)%2)

for i in range(N):
    r*=isok(t[i+1]-t[i],x[i+1]-x[i],y[i+1]-y[i])
print(['No','Yes'][r])