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

#初期位置と時間
x0=0
y0=0
t0=0


for i in range(N):
    #現在時刻と次の時間との差
    dt=t[i]-t0
    #現在位置と次の目標地点との距離
    d=abs(x0-x[i])+abs(y0-y[i])
    #距離が時間差よりも大きければ到達できないのでNO
    if dt-d<0:
        print("No")
        exit()
    #距離と時間差の偶奇が不一致なら到達できないのでNo
    if (dt-d)%2>0:
        print("No")
        exit()
    #初期位置を時刻tiのものに更新
    x0=x[i]
    y0=y[i]
    t0=t[i]

#上の条件をすべてクリアできていればYes
print("Yes")

Submission status: Accepted

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(' '))
 
 
 
ox = 0 
oy = 0
ot =0
 
for i in range(N):
    dt=t[i] - ot 
 
    d = abs(ox - x[i]) + abs(oy - y[i])
    if dt - d < 0:
        print('No')
        exit()
 
    if (dt-d)%2 > 0:
        print('No')
        exit()
 
    ox=x[i]
    oy=y[i]
    ot=t[i]
 
print('Yes')

Submission status: Accepted

Solution code:
import sys
nums = int(input())
ary = list(range(nums))
good = False

for i in range(nums):
    ary[i] = list(map(int,input().split()))

for i in range(nums):
    sum = ary[i][1]+ary[i][2]
    if sum % 2 == 1:
        if ary[i][0] >= sum and ary[i][0] % 2 == 1:
            good = True
        else:
            print("No")
            sys.exit()
    if sum % 2 == 0:
        if ary[i][0] >= sum and ary[i][0] % 2 == 0:
            good = True
        else:
            print("No")
            sys.exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#C - Traveling
num = int( input())
check = 0
step_b = 0
x_b = 0
y_b = 0
for i in range(num):
    step ,x ,y = map(int,input().split())
    if ((x-x_b)+(y-y_b) - (step-step_b)  > 0) or (((x-x_b)+(y-y_b) - (step - step_b))%2 == 1) :
        check = 1
        break
    x_b = x
    y_b = y
    step_b = step
if check == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = int(input())
t = [0] * n
x = [0] * n
y = [0] * n
ans = 'Yes'
for i in range(n):
  t[i], x[i], y[i] = map(int, input().split())

d = abs(x[0]) + abs(y[0])
if d not in range(t[0], -1, -2):
  ans = 'No'
  
for i in range(n-1):
  t_temp = t[i+1] - t[i]
  x_temp = abs(x[i+1] - x[i])
  y_temp = abs(y[i+1] - y[i])
  d = x_temp + y_temp
  if d in range(t_temp, -1, -2):
    continue
  else:
    ans = 'No'
print(ans)

Submission status: Accepted

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



ox = 0 
oy = 0
ot =0

for i in range(N):
    dt=t[i] - ot 

    d = abs(ox - x[i]) + abs(oy - y[i])
    if dt - d < 0:
        print('No')
        exit()

    if (dt-d)%2 > 0:
        print('No')
        exit()

    ox=x[i]
    oy=y[i]
    ot=t[i]

print('Yes')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n = int(input())
#n = 2

prev = [0,0,0]
for i in range(n):
    txy = list(map(int, input().split()))
    #txy = list(map(int, ["3 1 2", "6 1 1"][i].split()))
    t = txy[0] - prev[0]
    x = abs(txy[1] - prev[1])
    y = abs(txy[2] - prev[2])
    d = x + y
    if not(d <= t and (d - t) % 2 == 0):
        print('No')
        exit()
    prev = txy
print('Yes')

Submission status: Accepted

Solution code:
n=int(input())
s=0;a=0;b=0
for i in range(n):
  t,x,y=map(int,input().split())
  if abs(x-a)+abs(y-b)>t-s or (t-s-abs(x-a)-abs(y-b))%2!=0:
    print('No')
    exit()
  s=t;a=x;b=y
print('Yes')

Submission status: Accepted

Solution code:

N = int(input())

# x, y
start = [0, 0]

def get_tile(x, y):
    if x%2 == 0:
        if y %2 == 0: return 0
        else: return 1
    else:
        if y %2 == 0: return 1
        else: return 0


for i in range(N):
    t, x, y = map(int, input().split())
    tile_start = get_tile(start[0], start[1])
    tile_now = get_tile(x, y)

    if t % 2 == 0:
        if tile_start != tile_now:
            print('No')
            exit()
    else:
        if tile_start == tile_now:
            print('No')
            exit()

    if abs(x-start[0]) + abs(y-start[1]) > t:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
def main():
    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):
        diff = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
        time = t[i + 1] - t[i]
        if diff % 2 != time % 2 or diff > time:
            print("No")
            return
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
A=[list(map(int, input().split())) for i in range(N)]
A.insert(0,[0,0,0])
a=1
for i in range(N):
    d=abs(A[i+1][1]-A[i][1])+abs(A[i+1][2]-A[i][2])
    if d>A[i+1][0]-A[i][0] or d%2!=(A[i+1][0]-A[i][0])%2:
        a=0
        break
if a:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())
txy = [[int(i) for i in input().split()] for j in range(n)]

now = [0,0]
time = 0

for i in range(n):
    if abs(now[0]-txy[i][1]) + abs(now[1]-txy[i][2]) <= txy[i][0]:
        if (now[0]+now[1]) % 2 == (txy[i][1]+txy[i][2]+txy[i][0]-time) % 2:
            now[0] = txy[i][1]
            now[1] = txy[i][2]
            time = txy[i][0]
            #print(txy[i],time,now)
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
        
print("Yes")

Submission status: Accepted

Solution code:
n = int(input())
check = True
trip = [[0,0,0]]
for i in range(n):
    trip.append(list(map(int,input().split())))
for i in range(1,n+1):#1~nまでの繰り返し
    times = trip[i][0] - trip[i-1][0]#移動可能回数 
    distanceX = abs(trip[i][1] - trip[i-1][1])
    distanceY = abs(trip[i][2] - trip[i-1][2])
    distance = distanceX + distanceY
    if times < distance or (times + distance) % 2 != 0:
        check = False
        break
if check:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n=int(input())
ta=0
xa=0
ya=0
for i in range(n):
    t,x,y=map(int,input().split())
    if (x-xa)+(y-ya)>(t-ta) or (x+y+t)%2:
        print("No")
        exit()
    else:
        ta=t
        xa=x
        ya=y
print("Yes")

Submission status: Accepted

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

flg = True
for p in P:
  t, x, y = p
  if t < x + y:
    flg = False
    break
  if t%2 != (x+y)%2:
    flg = False
    break

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

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
cnt=0
e =np.array([[int(i) for i in input().split()] for i in range(n)])
if (e[0,0]-e[0,1]-e[0,2])<0 or (e[0,0]-e[0,1]-e[0,2])%2!=0:
    cnt=1
    print("No")
if cnt==0:
    for j in range(1,n):
        step = e[j,0]-e[j-1,0]
        dist = abs(e[j,1]-e[j-1,1])+abs(e[j,2]-e[j-1,2])
        if step<dist or (step-dist)%2!=0:
            print("No")
            cnt=1
            break
if cnt==0:
    print("Yes")

Submission status: Accepted

Solution code:
N=int(input())
S=[]
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())
tmp1 = [0, 0, 0]
for i in range(N):
    tmp2 = [int(i) for i in input().split()]
    t = tmp2[0] - tmp1[0]
    x = abs(tmp2[1] - tmp1[1])
    y = abs(tmp2[2] - tmp1[2])
    j = t - x - y
    if j >= 0 and j % 2 == 0:
        tmp1 = tmp2
    else:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
lt = lx = ly = 0
for i in range(n):
    t, x, y = map(int, input().split())
    tt = t - lt
    txy = abs(x - lx) + abs(y - ly)
    if txy > tt or tt % 2 != txy % 2:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
N = int(input())
nowx = nowy = time1 = 0
for i in range(N):
    t,x,y = map(int,input().split())
    time2 = abs(abs(nowx)-x)+abs(abs(nowy)-y)
    if ((t-time1)-time2)%2!=0 or time2>t-time1:
        print("No")
        exit()
    time1 = t
    nowx = x
    nowy = y
print("Yes")

Submission status: Accepted

Solution code:
import sys
def main():
  _int = int
  n = int(input())
  data = [[_int(e) for e in input().split()] for _ in range(n)]
  t, x, y = 0, 0, 0
  for d in data:
    rt = d[0] - t - abs(x - d[1]) - abs(y - d[2])
    if rt < 0 or rt & 1 == 1:
      print('No')
      sys.exit()
    t, x, y = d
  print('Yes')
main()

Submission status: Accepted

Solution code:
import sys
def main():
  _int = int
  _abs = abs
  n = int(input())
  data = [[_int(e) for e in input().split()] for _ in range(n)]
  t, x, y = 0, 0, 0
  for d in data:
    rt = d[0] - t - _abs(x - d[1]) - _abs(y - d[2])
    if rt < 0 or rt & 1 == 1:
      print('No')
      sys.exit()
    t, x, y = d
  print('Yes')
main()

Submission status: Accepted

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

def check():
    for i in range(N):
        t1,x1,y1 = txys[i]
        t2,x2,y2 = txys[i+1]

        dt = t2-t1
        dxy = abs(x1-x2) + abs(y1-y2)

        if dxy > dt:
            return False
        if (dxy - dt)%2 != 0:
            return False
        
    return True

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())

status = np.zeros((n + 1, 3), dtype=np.int)
for i in range(n):
    status[i + 1, :] = list(map(int, input().split()))

diff = np.diff(status, axis=0)
time = diff[:, 0]
step = np.sum(diff[:, 1:], axis=1)

if all(step <= time) and all(step % 2 == time % 2):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_,*p=map(int,open(0).read().split());print(('Yes','No')[sum(1 for t,x,y in zip(*[iter(p)]*3)if t<x+y or t%2!=(x+y)%2)>0])

Submission status: Accepted

Solution code:
def main():
    n, *data = map(int, open(0).read().split())
    res = 'No'

    t, x, y = 0, 0, 0
    for i in range(n):
        u, a, b = data[i*3:(i+1)*3]
        dt = u - t
        dist = abs(a-x) + abs(b-y)

        if dt < dist or dt % 2 != dist % 2:
            break
        t, x, y = u, a, b
    else:
        res = 'Yes'

    print(res)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

txy.insert(0, [0,0,0])
able =True

for i in range(1, n+1):
    dt = txy[i][0] - txy[i-1][0]
    dx = txy[i][1] - txy[i-1][1]
    dy = txy[i][2] - txy[i-1][2]
    if dt < abs(dx) + abs(dy):
        able = False
        break
    if dt%2==0 and (abs(dx) + abs(dy))%2==1:
        able = False
        break
    if dt%2==1 and (abs(dx) + abs(dy))%2==0:
        able = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
for _ 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())
x = [list(map(int, input().split())) for _ in range(n)]

f = True
for i in range(n):
    if i == 0:
        l = x[0][0] - (x[0][1] + x[0][2])
        if l < 0 or l % 2 != 0:
            f = False
            break
    else:
        l = (x[i][0] - x[i-1][0]) - (x[i][1]-x[i-1][1] + x[i][2]-x[i-1][2])
        if l < 0 or l % 2 != 0:
            f = False
            break

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

Submission status: Accepted

Solution code:
N=int(input())

A=[]

for i in range(N):
    B = list(map(int, input().split()))
    A.append(B)

for i in range(N):
    if i==0:
        if A[i][0]<A[i][1]+A[i][2]:
            print('No')
            exit(0)
        elif A[i][0]%2!=(A[i][1]+A[i][2])%2:
            print('No')
            exit(0)
    else:
        if A[i][0]-A[i-1][0]<abs(A[i][1]+A[i][2]-(A[i-1][1]+A[i-1][2])):
            print('No')
            exit(0)
        elif (A[i][0]-A[i-1][0])%2!=abs(A[i][1]+A[i][2]-(A[i-1][1]+A[i-1][2]))%2:
            print('No')
            exit(0)
print('Yes')

Submission status: Accepted

Solution code:

#入力受け取り
n = int(input())
tourList = []
for i in range(n):
    array = list(map(int, input().strip().split()))
    tourList.append(array)

#DebugPrint
currentTime = 0
currentX = 0
currentY = 0

for i in range(len(tourList)) :
    Time = tourList[i][0]
    X = tourList[i][1]
    Y = tourList[i][2]

    Time = Time - currentTime
    X = X - currentX
    Y = Y - currentY
    flag=False

    NUM = abs(X)+abs(Y)
    if( (Time-NUM)%2==0 and NUM <= Time):
        flag=True

    # while (X+Y+Z) <= Time :
    #     if X+Y+Z == Time:
    #         flag=True
    #         break
    #     else:
    #         Z+=2
    
    #継続判定
    if flag == False:
        print("No")
        exit()
    
    currentTime = Time
    currentX = X
    currentY = Y

print("Yes")

    #最初の点がまず実現可能か

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())

prev_x = 0
prev_y = 0
prev_t = 0

for n in range(N):
  t, x, y = [int(i) for i in stdin.readline().rstrip().split()]
  min_t = abs(x - prev_x) + abs(y - prev_y)
  if((t - prev_t < min_t) or ((t-prev_t-min_t) % 2 != 0)):
    print('No')
    exit()
  
print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
a = []

for i in range(n):
    a.append(list(map(int, input().split())))

for i in a:
    if i[0] < i[1] + i[2] or sum(i) % 2:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
import sys

N = int(input())

txy = [(0, 0, 0)] + [tuple(map(int,input().split())) for i in range(N)]

for i in range(N):
    ti,  xi,  yi  = txy[i]
    ti_, xi_, yi_ = txy[i+1]
    # print(ti, xi, yi)
    # print(ti_, xi_, yi_)

    tdiff = ti_ - ti
    xdiff = xi_ - xi
    ydiff = yi_ - yi
    # print(tdiff, xdiff, ydiff)

    # print(
    #     (tdiff % 2 == (xdiff + ydiff) %2),
    #     (abs(xdiff) <= tdiff),
    #     (tdiff % 2 == ydiff % 2),
    #     (abs(ydiff) <= tdiff)
    # )

    if (
            (tdiff % 2 == (xdiff + ydiff) %2)
            and (abs(xdiff) + abs(ydiff) <= tdiff)
    ):
        continue
    else:
        print('No')
        sys.exit()

print('Yes')
sys.exit()

Submission status: Accepted

Solution code:
N = int(input())
txy = [[0,0,0]]
for i in range(N):
    txy.append([int(x) for x in input().split()])
flg = 0

for j in range(1, N + 1):
    dt = txy[j][0] - txy[j - 1][0]
    dx = txy[j][1] - txy[j - 1][1]
    dy = txy[j][2] - txy[j - 1][2]
    d = dt - abs(dx) - abs(dy)

    if d < 0 or d % 2 != 0:
        print("No")
        flg = 1
        break

if flg == 0:
    print("Yes")

Submission status: Accepted

Solution code:
N = int(input())

inp = [[int(_) for _ in input().split()] for i in range(N)]
cx, cy, ct = 0, 0, 0

for t, x, y in inp:
    mv = abs(cx - x) + abs(cy - y)
    if mv + ct > t or (t - ct - mv) % 2 == 1:
        print('No')
        exit()
    cx, cy, ct = x, y, t

print('Yes')

Submission status: Accepted

Solution code:
n=int(input())

li=[list(map(int,input().split())) for i in range(n)]
li.insert(0,[0,0,0])
#print(li)

for i in range(n) :
  cr=li[i]
  nx=li[i+1]
  dist=abs(nx[1]-cr[1])+abs(nx[2]-cr[2])
  dt=nx[0]-cr[0]
  if dt<dist :
    print("No")
    exit()
  if (dt%2) != (dist%2) :
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

for i in range(1, N+1):
    dt = P[i][0] - P[i-1][0]
    dx = P[i][1] - P[i-1][1]
    dy = P[i][2] - P[i-1][2]

    dist = abs(dx) + abs(dy)

    if dt < dist:
        print('No')
        exit()

    if (dt - dist) % 2:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())

    if i == 0:
        if x + y != t:
            print('No')
            exit()
        else:
            bx = x
            by = y
            bt = t
    else:
        d = abs(x - bx) + abs(y - by)
        dt = t - bt
        bx = x
        by = y
        bt = t

        # print(d, dt)
        if d > dt:
            print('No')
            exit()

        elif d % 2 == 1 and dt % 2 == 0:
            print('No')
            exit()
        elif d % 2 == 0 and dt % 2 == 1:
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
li_1 = [list(map(int,input().split())) for i in range(n)]
li = [[0,0,0]] + li_1
for i in range(n):
  x = abs(li[i][1]-li[i+1][1])
  y = abs(li[i][2]-li[i+1][2])
  t = li[i+1][0] - li[i][0]
  c = t - x - y
  if c < 0 or c%2 == 1:
    print("No")
    break
  elif i == n-1:
    print("Yes")

Submission status: Accepted

Solution code:
from sys import stdin

input = stdin.readline
lines = stdin.readlines

n = int(input())

txy = ((map(int, line.split())) for line in lines())
ans = "Yes"
t,x,y = 0,0,0

for t1,x1,y1 in txy:
    
    td,dis = t1-t,abs(x1-x)+abs(y1-y)
    if td%2 != dis%2 or td < dis:
        ans = "No"
        break
    t,x,y = t1,x1,y1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = "Yes"
t,x,y = 0,0,0
for i in range(n):
    t1,x1,y1 = map(int,input().split())
    td,dis = t1-t,x1+y1-x-y
    if td%2 != dis%2 or td < dis:
        ans = "No"
        break
    t,x,y = t1,x1,y1
print(ans)

Submission status: Accepted

Solution code:
def validation(l1, l2):
  dif_t = abs(l2[0] - l1[0])
  dif_x = abs(l2[1] - l1[1])
  dif_y = l2[2] - l1[2]

  if dif_x + dif_y > dif_t:
    return False
  elif dif_t % 2 == 0:
    if (dif_x + dif_y) % 2 != 0:
      return False
    else:
      return True
  elif dif_t % 2 != 0:
    if (dif_x + dif_y) % 2 == 0:
      return False
    return True
  else:
    return True

n = int(input())
l1 = [0,0,0]
ans = "Yes"
for _ in range(n):
  l2 = list(map(int, input().split()))
  if  validation(l1, l2):
    l1 = l2
  else:
    ans = "No"

print(ans)

Submission status: Accepted

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

for t, x, y in cordinates:
    # x+yは時刻t毎に偶奇が入れ替わる
    if (x+y) > t or ((x+y) % 2 != t % 2):
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

for t, x, y in cordinates:
    # x+yは時刻t毎に偶奇が入れ替わる
    if (x+y) > t or (x+y+t)%2:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

for i in range(n):
  ti, xi, yi = [int(li) for li in input().split()]
  t.append(ti)
  x.append(xi)
  y.append(yi)


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


result = "Yes"
for i in range(n):
  if t[i+1] - t[i] < distance(x[i+1], y[i+1], x[i], y[i]):
    result = "No"
    break
  if ((t[i+1] - t[i]) + distance(x[i+1], y[i+1], x[i], y[i])) % 2 != 0:
    result = "No"
    break

print(result)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
to,xo,yo=0,0,0
for _ in range(n):
    t,x,y=map(int,input().split())
    dt=t-to
    dz=abs(xo-x)+abs(yo-y)
    if dz>dt or (dt-dz)&1:
        print('No')
        sys.exit()
    to,xo,yo=t,x,y
print('Yes')

Submission status: Accepted

Solution code:
N = int(input())
points = [tuple(map(int, input().split())) for i in range(N)]
points = [(0,0,0)] + points
for idx in range(1,N + 1):
  time_diff = points[idx][0] - points[idx-1][0]
  x_diff = abs(points[idx][1] - points[idx-1][1])
  y_diff = abs(points[idx][2] - points[idx-1][2])
  
  if (time_diff < x_diff + y_diff) or (time_diff - x_diff - y_diff) % 2 == 1:
    print('No')
    exit()
    
print('Yes')

Submission status: Accepted

Solution code:
N = int(input())

nowT, nowX, nowY = 0, 0, 0

ans = True

for _ in range(N):
    nextT, nextX, nextY = map(int, input().split())
    dist = abs(nextX - nowX) + abs(nextY - nowY)
    time = nextT - nowT
    if dist > time:
        ans = False
    if (dist % 2) != (time % 2):
        ans = False
    nowT, nowX, nowY = nextT, nextX, nextY

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

Submission status: Accepted

Solution code:
N = int(input())
T, X, Y = 0, 0, 0

for _ in range(N):
    t, x, y = list(map(int, input().split()))
    a = t - T
    b = abs(X - x)
    c = abs(Y - y)

    if a < b + c or a % 2 != (b + c) % 2:
        print('No')
        exit()
    T, X, Y = t, x, y

print('Yes')

Submission status: Accepted

Solution code:
n=int(input())
a=0
b=0
c=0
for i in range(n):
	d,e,f=map(int,input().split())
	if abs(f-c)+abs(e-b)<=d-a and \
	(d-a-(abs(f-c)+abs(e-b)))%2==0:
		a=d
		b=e
		c=f
	else:
		print("No")
		exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

n = int(input())
t0,x0,y0 = 0,0,0
for i in range(n):
    t,x,y = map(int, input().split())
    d = abs(x-x0) + abs(y-y0)
    dd = (t-t0) - d
    if dd < 0 or dd % 2 != 0:
        print("No")
        exit()
    t0,x0,y0 = t,x,y
print("Yes")

Submission status: Accepted

Solution code:
n = int(input())
ans = "Yes"
tp = 0
xyp = [0,0]
for i in range(n):
    t,x,y = map(int,input().split())
    d = abs(x-xyp[0])+abs(y-xyp[1])
    if d <= t-tp:
        if ((t-tp)-d)%2 == 1:
            ans = "No"
    else:
        ans = "No"
        
    tp = t
    xyp = [x,y]
print(ans)

Submission status: Accepted

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

def isOk(txy):
    now_pos=0
    now_t=0

    for t,x,y in txy:
        move=x+y-now_pos
        time=t-now_t
        if time>=move and time%2==move%2:
            continue
        else:
            return False
    return True

print("Yes") if isOk(txy) else print("No")

Submission status: Accepted

Solution code:
import sys
n=int(input())
t=[]
x=[]
y=[]
t.append(0)
x.append(0)
y.append(0)
for i in range(1,n+1):
    a,b,c=map(int,input().split())
    t.append(a)
    x.append(b)
    y.append(c)
for j in range(1,n+1):
    S = abs(x[j]-x[j-1])+abs(y[j]-y[j-1])  #1つの移動最短距離
    T =t[j]-t[j-1] #その所用時間
    if S>T: #もし所用時間よりも距離が長ければ無理
        print("No")
        sys.exit()
    elif S%2==0: #もしも距離が偶数であれば
        if T%2==0: #時間も偶数であればOK
            continue
        else: #距離が偶数で時間が奇数ならダメ
            print("No")
            sys.exit()
    elif T%2!=0: #距離が奇数で、時間も奇数ならOK
        continue
    else:
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

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

dt = [0] * n
dx = [0] * n
dy = [0] * n

for i in range(n):
    dt[i] = _[i + 1][0] - _[i][0]
    dx[i] = _[i + 1][1] - _[i][1]
    dy[i] = _[i + 1][2] - _[i][2]

ans = "Yes"

for i in range(n):
    man_d = abs(dx[i]) + abs(dy[i])
    if not (dt[i] >= man_d and (dt [i]- man_d) % 2 == 0):
        ans = "No"

print(ans)

Submission status: Accepted

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

dt = [_[i + 1][0] - _[i][0] for i in range(n)]
dx = [_[i + 1][1] - _[i][1] for i in range(n)]
dy = [_[i + 1][2] - _[i][2] for i in range(n)]

ans = "Yes"

for i in range(n):
    man_d = abs(dx[i]) + abs(dy[i])
    if not (dt[i] >= man_d and (dt [i]- man_d) % 2 == 0):
        ans = "No"

print(ans)

Submission status: Accepted

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

dt = [_[i + 1][0] - _[i][0] for i in range(n)]
dx = [_[i + 1][1] - _[i][1] for i in range(n)]
dy = [_[i + 1][2] - _[i][2] for i in range(n)]

for i in range(n):
    man_d = abs(dx[i]) + abs(dy[i])
    if dt[i] >= man_d and (dt [i]- man_d) % 2 == 0:
        ans = "Yes"
    else:
        ans = "No"
        break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
list_1 = [[0,0,0]]
for i in range(N):
    list_1.append([int(i) for i in input().split()])

flag = True
for i in range(N):
    delta_t = list_1[i+1][0]-list_1[i][0]
    delta_x = list_1[i+1][1]-list_1[i][1]
    delta_y = list_1[i+1][2]-list_1[i][2]
    delta_move = delta_x + delta_y
    if delta_t < delta_move or delta_t%2 != delta_move%2:
        flag = False
        break
        
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    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())
        diff_t = t[i] - t[i-1]
        dist = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])
        if diff_t < dist:
            print('No')
            exit()
        elif diff_t >= dist:
            if diff_t % 2 == dist % 2:
                continue
            else:
                print('No')
                exit()
    print('Yes')


main()

Submission status: Accepted

Solution code:
n = int(input())
 
f = True
for i in range(n):
  t,x,y = map(int,input().split())
  et = t
  exy = x+y
  et-=exy
  
  if(et>=0):
    if(et%2==0):
      continue
    else:
      f = False
      break
  else:
    f = False
    break
 
if (f):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
px = 0
py = 0
pt = 0
n = int(input())

for _ in range(n):
	nt, nx, ny = list(map(int,input().split()))
	dt, dx, dy = abs(nt - pt), abs(nx - px), abs(ny - py)
	if dx + dy > dt or (dx + dy - dt) % 2 == 1:
		print("No")
		exit()
	else:
		pt,px,py = nt, nx, ny
    
print("Yes")

Submission status: Accepted

Solution code:
N = int(input())

plist = [(0,0,0)]
for _ in range(N):
	plist.append(tuple(map(int, input().split())))

judge = 'Yes'
for i in range(N):
	mae = plist[i]
	usi = plist[i+1]

	time_diff = usi[0] - mae[0]
	road = abs(usi[1] - mae[1]) + abs(usi[2] - mae[2])

	if time_diff < road:
		judge = 'No'
	elif time_diff >= road:
		yozyo = time_diff - road
		if yozyo % 2 != 0:
			judge = 'No'

print(judge)

Submission status: Accepted

Solution code:
n = int(input())
t_base, x_base, y_base = 0, 0, 0
ans = True
for _ in range(n):
    t_new, x_new, y_new = map(int, input().split())
    dt, dx, dy = abs(t_new - t_base), abs(x_new - x_base), abs(y_new - y_base)

    if dx + dy > dt or (dx + dy - dt) % 2 == 1:
        ans = False
        break
    t_base, x_base, y_base = t_new, x_new, y_new

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

Submission status: Accepted

Solution code:
n = int(input())
bt = 0
bx = 0
by = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    elp = t-bt
    ex = x-bx
    ey = y-by
    nes = ex + ey
    elp -=  nes
    if elp >= 0:
        if elp %2 == 0:
            continue
        else:
            flag = False
            break
    else:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())
ct ,cx, cy = (0, 0, 0) #Current t,x, y
for i in range(N):
    get = input().split()
    nt = int(get[0])
    nx = int(get[1]) #Next x, y
    ny = int(get[2])
    dt, dx, dy = nt - ct, nx - cx, ny - cy
    if dt < dx + dy:
        print("No")
        break
    elif dt > dx + dy and (dt - (dx + dy)) % 2 == 1:
        print("No")
        break
    ct = nt
    cx = nx
    cy = ny
else:
    print("Yes")

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) % 2 != t % 2:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
N=int(input())
tt = xx = yy = 0

for i in range(N):
    t, x, y = map(int,input().split())
    dif = abs(x-xx) + abs(y - yy)
    if dif > t - tt:
        print("No")
        quit();
    else:
        if (t-tt-dif)%2 != 0:
            print("No")
            quit()
    tt = t
    xx = x
    yy = y

print("Yes")

Submission status: Accepted

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

hantei = True
xtemp = 0
ytemp = 0
ttemp = 0
for i in range(N):
    t = abs(zahyo[i][0] - ttemp)
    x = abs(zahyo[i][1] - xtemp)
    y = abs(zahyo[i][2] - ytemp)
    ttemp = zahyo[i][0]
    xtemp = zahyo[i][1]
    ytemp = zahyo[i][2]

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

t,a,b = 0,0,0
for i in range(N):
	d = abs(a-X[i][1]) + abs(b-X[i][2])
	if d > (X[i][0]-t):
		print("No")
		exit()
	else:
		if ((X[i][0]-t)-d)%2 == 1:
			print("No")
			exit()
		else:
			t = X[i][0]
			a = X[i][1]
			b = X[i][2]
print("Yes")

Submission status: Accepted

Solution code:
n = int(input())
t = 0
x = 0
y = 0
for i in range(n):
  T,X,Y = map(int,input().split())
  man = abs(X-x) + abs(Y-y)
  woman = T-t
  if man > woman or man % 2 != woman % 2:
    print('No')
    break
  t,x,y = T,X,Y
else:
  print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
ad_list =[[0, 0, 0]]
flag = 0
for i in range(n):
    ad_list.append(list(map(int, input().split())))
for j in range(1, n + 1):
    t = ad_list[j][0] - ad_list[j - 1][0]
    l = abs(ad_list[j][1] - ad_list[j - 1][1]) + abs(ad_list[j][2] - ad_list[j - 1][2])
    if t >= l and t % 2 == l % 2:
        continue
    else:
        flag = 1
if flag == 0:
    print('Yes')
else:
    print('No')