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: Accepted

Solution code:
import subprocess
import gzip, base64, os
import stat

gz = b'H4sIAEgsaV0C/+19e3wURbZ/z+Q1vDIBUSMIDBgxiIQMBEh0lYQw0COTEElAfGAzmUxINJnJb6YnBFeXYBKXcYiyrtd13V1lvbter+7eZb1eF1mFIErQ9YGiyEMFFXSGgOILsgrM75yq6kl1T3cE3fv74/exldScb5+qOnXq1KlHd1etdLjmmE0mQbnMwlUCUm+MKCZ0McObPAkWwAqFAfB3jHChkA50GsdXLBSrwl6WtBJaGF8K/EuFf4VmSheai1XhhYxPCU1cmCbwV7Eq/GqhoAoFwZaIh7LuXkLR3UuWqsLeFIpnZajjmVm8XhavV+FnoWAWVKFSvlT2r4rhVaxcSjib8c3m+PGqOCTX4O/e+Sy/+cWqsJ3xtWviXQPx0oUzv7JYuIDlZ6SXXC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mpmesqqRt58Ds7XN1PBMbD3DTTpGVldwvbOwddqIzkm3Wi6dw5O1ZgDFU3xY0tHRydZFThxOhrmzsLXp1wT9Uh30jaA8esStbgtD/8QGPf/CM7vV3qBIOShXa5zqM6e1pUs+rVlbxOpgkLOIxIHlSZVxRqcYFxdzp/Imn72s6zOSDmJOTkR9WLVeKuoD39Up6B4Tb3DsujptemCxjjv4fsePa1yN11+rNafEIe3qEpDe9/sdAa7Jk3y9m2RCZ3wCt05HOoPvSEllNhs1d4PTzfXqkzseXaMK8oaZ3rnmyWbzLzi/W6cb1Ckd68+SHJ3q0Gy4xw60JsJNR7OH+XFyV8Idb56cFzugXEcI7entyabctKKv5u0FyYeAa2LgGdzUr/1fJ9U4jzOLAAA='
bin = gzip.decompress(base64.b64decode(gz))
p = os.path.dirname(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)


# compiled by pythran
'''
#pythran export main2()
def main2():
    stdin = open('/dev/stdin')
    N = int(stdin.readline())
    t0 = 0
    x0 = 0
    y0 = 0
    for _ in range(N):
        t1, x1, y1 = map(int, stdin.readline().split())
        t = t1 - t0
        r = abs(x1 - x0) + abs(y1 - y0)
        if t < r or t & 1 != r & 1:
            print('No')
            return
    print('Yes')
'''

Submission status: Accepted

Solution code:
import sys
from statistics import *
from collections import *
from operator import itemgetter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
st = 0
sx = 0
sy = 0
ans = 'Yes'
for i in range(n):
    t, x, y = na()
    dt = abs(st - t)
    dx = abs(sx - x)
    dy = abs(sy - y)
    if dt >= dx + dy and dt % 2 == (dx + dy) % 2:
        st, sx, sy = t, x, y
        continue
    else:
        ans = 'No'
        break
print(ans)

Submission status: Accepted

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

ans='Yes'
for i in range(n):
  dt=txy[i+1][0]-txy[i][0]
  dx=abs(txy[i+1][1]-txy[i][1])
  dy=abs(txy[i+1][2]-txy[i][2])
  if (dt-(dx+dy))%2!=0 or dt<dx+dy:
    ans='No'
    break
print(ans)

Submission status: Accepted

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

judge = True
pos = [0,0,0]
for p in PX:
    t = pos[0]
    x = pos[1]
    y = pos[2]
    ti = p[0]
    xi = p[1]
    yi = p[2]
    if abs(x-xi)+abs(y-yi) > (ti-t):
        judge = False
    if (x+y+(ti-t))%2 != (xi+yi)%2:
        judge = False
if judge:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
num = int(input())
figx =0
figy =0

count = 0
for i in range(num):
    time,x,y = map(int,input().split())
    distance = x + y - figx - figy
    if distance <= time and (time % 2 == distance %2):
        count += 1
    
    x=figx
    y=figy
        
if count == num:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())
T = [0]
X = [0]
Y = [0]
for a in range(N + 1):
    if a == N:
        break
    L = input().split()
    T.append(int(L[0]))
    X.append(int(L[1]))
    Y.append(int(L[2]))
    if abs(X[a + 1] - X[a]) + abs(Y[a + 1] - Y[a]) <= T[a + 1] - T[a] and (abs(X[a + 1] - X[a]) + abs(Y[a + 1] - Y[a])) % 2 == (T[a + 1] - T[a]) % 2:
        pass
    else:
        break
if a == N:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())
t, x, y = [0], [0], [0]
for i in range(N):
    ti, xi, yi = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
flag = 1
for i in range(N):
    if flag == 1:
        dt = t[i+1]-t[i]
        dx = x[i+1]-x[i]
        dy = y[i+1]-y[i]
        if (dt+dx+dy)%2 != 0 or (dt+dx+dy) < 0:
            flag = 0
        if (dt-dx-dy)%2 != 0 or (dt-dx-dy) < 0:
            flag = 0


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

Submission status: Accepted

Solution code:
n = int(input())
for _ in range(n):
  dt, dx, dy = list(map(int, input().split()))
  if( (dx + dy) > dt ):
    print("No")
    exit()
  if((dx + dy) % 2 != dt % 2):
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys

N = int(input())
tLst = [list(map(int, input().split())) for i in range(N)]
tx = 0
ty = 0
t = 0
for i in range(N):
    tmp = (abs(tx - tLst[i][1]) + abs(ty - tLst[i][2]))
    ttmp = tLst[i][0] - t
    tt = ttmp - tmp
    if tt == 0 or\
            (tt + tmp == t and tt % 2 == 0):
        tx = tLst[i][1]
        ty = tLst[i][2]
        t = tLst[i][0]
        continue
    else:
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

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())

for i in range(n):
    tmp = abs(t[i+1]-t[i]) - (abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]))
    if tmp < 0 or tmp % 2 != 0:    
        print('No')
        quit()
print('Yes')

Submission status: Accepted

Solution code:
N = int(input())
x = 0
y = 0
t = 0
for i in range(N):
    t_i,x_i,y_i=map(int,input().split())
    x = x_i - x
    y = y_i - y
    t = t_i - t
    if t >= x + y and ( t - (x + y) )%2 == 0:
        if i == N -1:
            print("Yes")
    
    else:
        print("No")
        break

Submission status: Accepted

Solution code:
N = int(input())
flag = True
t_0,x_0,y_0 = 0,0,0

for i in range(N):
    t_1,x_1,y_1 = map(int,(input().split()))
    dt = t_1 - t_0
    dx = abs(x_1 - x_0)
    dy = abs(y_1 - y_0)
    if dx+dy<=dt and (dx+dy+dt)%2==0:
        t_0,x_0,y_0 = t_1,x_1,y_1
    else:
        flag = False
        break

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

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    txy = list(map(int, input().split()) for _ in range(n))
    now_t, now_x, now_y = 0, 0, 0
    for t, x, y in txy:
        dt, dx, dy = t - now_t, x - now_x, y - now_y
        if dt % 2 != (abs(dx) + abs(dy)) % 2 or dt < abs(dx) + abs(dy):
            return "No"
        now_t, now_x, now_y = t, x, y
    return "Yes"


def resolve():
    print(solve())


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())

t1, x1, y1 = 0, 0, 0
flg = True

for i in range(N):
    t2, x2, y2 = map(int, input().split())
    d = abs(x1-x2) + abs(y1-y2)
    dt = t2 - t1
    if d > dt or (dt - d)%2 == 1:
        flg = False
        break
    t1, x1, y1 = t2, x2, y2

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

Submission status: Accepted

Solution code:
import sys
import math

def q60(t, x, y, n):
    for i in range(1, n+1):
        s = t[i] - t[i - 1]
        k = abs(x[i] - x[i - 1])
        l = abs(y[i] - y[i - 1])
        p = k + l
        #print(k)
        #print(l)
        #print(s)
        if not s % p == 0:
            print('No')
            return
    print('Yes')

N = int(input())

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

t.insert(0, 0)
x.insert(0, 0)
y.insert(0, 0)
q60(t, x, y ,N)

Submission status: Accepted

Solution code:
def check():
    N = int(input())
    t1,x1,y1 = [0,0,0]
    
    for _ in range(N):
        t2,x2,y2 = [int(i) for i in input().split(' ')]
        x_sub = abs(x1-x2)
        y_sub = abs(y1-y2)
        t_sub = t2 - t1
        t = t_sub - x_sub - y_sub
        if t < 0:
            return 'No'
        else:
            if t % 2 == 0:
                t1 = t2
                x1 = x2
                y1 = y2
            else:
                return 'No'
    return 'Yes'
print(check())

Submission status: Accepted

Solution code:
manhattan_distance = lambda x1, y1, x2, y2 : abs(x1-x2)+abs(y1-y2)

def solve():
    N = int(input())
    t_pre = 0
    x_pre = 0
    y_pre = 0
    for _ in range(N):
        t, x, y = map(int, input().split())
        # print(manhattan_distance(x, y, x_pre, y_pre), t - t_pre)
        reach = (t - t_pre) - manhattan_distance(x, y, x_pre, y_pre)
        if not ( reach >= 0 and reach%2 == 0):
            print('No')
            return
        
    print('Yes')
    
solve()

Submission status: Accepted

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: Accepted

Solution code:
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
 
t1, x1, y1 = 0, 0, 0 
for t2, x2, y2 in D:
  t = t2 - t1
  d = abs(x2 - x1) + abs(y2 - y1)
  if d > t or (t - d) % 2:
    print('No')
    break
  t1, x1, y1 = t2, x2, y2
else:
  print('Yes')

Submission status: Accepted

Solution code:
N = int(input())

ans = 'Yes'
pos = {'x': 0, 'y': 0}
elapsed_t = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    t -= elapsed_t
    d = abs(x - pos['x']) + abs(y - pos['y'])
    if not (t % 2 == d % 2 and d <= t):
        ans = 'No'
        break
    pos['x'], pos['y'] = x, y
    elapsed_t += t

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
tzero=0
xzero=0
yzero=0
feasibility=1

for i in range(N):
    t,x,y=map(int,input().split())
    dist=abs(x-xzero)+abs(y-yzero)
    dt=t-tzero
    if dist>dt:
        feasibility=0
        break
    if dist%2 != dt%2:
        feasibility=0
        break
if feasibility==0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    n = int(input())
    _t = 0
    _x = 0
    _y = 0
    reachable = True
    for _ in range(n):
        t, x, y = map(int, input().split())
        if reachable:
            diff = t-_t
            distance = abs(x-_x)+abs(y-_y)
            if diff >= distance and (distance-diff)%2==0:
                continue
            else:
                reachable = False
    print("Yes" if reachable else "No")

input = lambda: stdin.readline().rstrip()
main()

Submission status: Accepted

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

can_exec = True
for i in range(len(input_list)):
    t_i = input_list[i][0]
    x_i = input_list[i][1]
    y_i = input_list[i][2]
    if (x_i + y_i) > t_i or (t_i + x_i + y_i) % 2 ==1:
        can_exec = False
        print('No')
        break
if can_exec == True:
    print('Yes')

Submission status: Accepted

Solution code:
n = int(input())

ts = [0]
xs = [0]
ys = [0]

for _ in range(n):
    t, x, y = map(int, input().split())
    ts.append(t)
    xs.append(x)
    ys.append(y)

ok = True
for i in range(n):
    dt = ts[i + 1] - ts[i]
    dist = abs(xs[i + 1] - xs[i]) + abs(ys[i + 1] - ys[i])
    if dt < dist:
        ok = False
        break
    else:
        if (dt - dist) % 2 != 0:
            ok = False
            break

if ok:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N=int(input())
oldn,oldx,oldy=0,0,0
#print(x,y)
no=0
for i in range(N):
  nxy=input().split()
  n,x,y=int(nxy[0]),int(nxy[1]),int(nxy[2])
#  print(n,x,y)
  ndiff = n - oldn
  distance = abs(x - oldx) + abs(y - oldy)
#  print(ndiff,distance)
  oldn,oldx,oldy=n,x,y
  if distance > ndiff:
    print("No")
    no=1
    break
#  print((ndiff-distance)%2)
  if (ndiff-distance)%2==0:
    continue
  else:
    no=1
    print("No")
    break
if no==0:
  print("Yes")

Submission status: Accepted

Solution code:
import math
import numpy as np


#横並び
#a, b, c, x = map(int, [input() for i in range(4)])
#z = list(map(int, input().split()))
#n, a, b = map(int, input().split())

#print(len(z))
#for i in z:
#    print(i)

#a = sorted(a,reverse = True)
#print(sum(a[::2]) - sum(a[1::2]))
#z = map(int, [input() for i in range(int(n))])
#data_list = [ list(map(int,input().split(" "))) for i in range(3)]



n = int(input())
ans = 1
ta = 0
xa = 0
ya = 0
for i in range(n):
    t,x,y = map(int, input().split())
    if (((t-ta) - (x-xa) - (y-ya)) % 2) == 0 and ((t-ta) >= (abs(x-xa) + abs(y - ya))):
        ans = ans *1
    else:
        ans = ans * 0
if ans:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n=int(input())

ta=0
xa=0
ya=0
count=0

for i in range(n):
  t,x,y=map(int,input().split())
  if (x-xa+y-ya)<=t-ta and (t-ta+x-xa+y-ya)%2==0:
    ta=t
    xa=x
    ya=y
    count+=1

print("Yes" if count==n else "No")

Submission status: Accepted

Solution code:
n=int(input())

tb = 0
xb = 0
yb = 0
count = 0

for i in range(n):
  t,x,y=map(int,input().split())
  if (x-xb+y-yb)<=t-tb and (t-tb+x-xb+y-yb)%2==0:
    tb = t
    xb = x
    yb = y
    count += 1

print("Yes" if count == n else "No")

Submission status: Accepted

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

ans = "Yes"

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

for i in range(1,N+1):
  dt = t[i] - t[i-1]
  dist = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
  if dt < dist:
    ans ="No"
  elif dt % 2 != dist % 2:
    ans = "No"
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

pt, px, py = 0,0,0
for i in range(N):
    t, x, y = map(int, input().split())
    limit = t - pt
    dist = abs(x - px) + abs(y - py)
    if dist % 2 != limit % 2:
        print("No")
        break

    if dist <= limit:
        # print("pass")
        pt, px, py = t, x, y
        continue

    print("No")
    break
else:
    print("Yes")

Submission status: Accepted

Solution code:
n = int(input())
d_inp = [input() for i in range(n)]
can = False
d = []
for i in range(n):
    d.append(list(map(int, d_inp[i].split())))
ct = 0
cx = 0
cy = 0
for i in range(n):
    dt = d[i][0]-ct
    dx = d[i][1]-cx
    dy = d[i][2]-cy
    if dx+dy > dt:
        break
    if (dx+dy) % 2 != dt % 2:
        break
    ct += dt
    cx += dx
    cy += dy
else:
    can = True
if can == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    st = []
    for _ in range(N):
        t, x, y = map(int, input().split())
        st.append([t, x, y])
    cur = [0, 0, 0]
    for i in range(N):
        t1, x1, y1 = cur
        t2, x2, y2 = st[i]
        d = abs(x2-x1) + abs(y2-y1)
        if t2-t1 >= d and (t2-t1-d) % 2 == 0:
            cur = st[i]
        else:
            return "No"
    return "Yes"

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    data = []
    for i in range(n):
        tt, xx, yy = [int(i) for i in input().split()]
        data.append([tt, xx, yy])

    nx, ny = 0, 0
    nt = 0
    for t, x, y in data:
        # x + y が偶数か奇数か
        tt = t-nt; tx = x-nx; ty = y-ny
        if not ((abs(tx)+abs(ty)) % 2 == tt % 2) or abs(tx)+abs(ty) > tt:
            print('No')
            break
    else:
        print('Yes')


if __name__ == '__main__':
    main()