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())
s = [input().split() for i in range(n)]
sum = 0

for locate in s:
    t = int(locate[0])
    x = int(locate[1])
    y = int(locate[2])
    if x+y <= t:
        if (x+y)%2==0 and t%2==0:
            sum += 1
        elif (x+y)%2!=0 and t%2!=0:
            sum += 1

if sum == n:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N=int(input())
pos=[0,0]
jt=0
arr=[]
for i in range(N):
    t,x,y=map(int,input().split())
    a=t-jt
    b=abs(pos[0]-x)+abs(pos[1]-y)
    arr.append(a%2==b%2 and a>=b)
    jt=t
    pos=[x,y]
print('Yes' if all(arr) else 'No')

Submission status: Accepted

Solution code:
N = int(input())
t = x = y = 0
for i in range(N):
  tn,xn,yn = map(int,input().split())
  dt = tn-t
  d = abs(xn-x)+abs(yn-y)
  if d <= dt and dt%2 == d%2:
    t,x,y = tn,xn,yn
    isValid = True
  else:
    isValid = False
    break
print("Yes" if isValid else "No")

Submission status: Accepted

Solution code:
def cc086():
    n = int(input())
    txy = list()
    for i in range(0, n):
        t = list(map(int, input().split()))
        txy.append(t)

    pos = [0, 0, 0]
    for i in range(0, n):
        t,x,y = txy[i][0:]
        dt = t - pos[0]
        dx = abs(pos[1] - x)
        dy = abs(pos[2] - y)
        dz = dx + dy

        if dz <= dt and dt%2 == dz%2:
            pos = [t, x, y]
        else:
            print('No')
            import sys
            sys.exit()

    print('Yes')

cc086()

Submission status: Accepted

Solution code:
import math
n = int(input())
a = [[0,0,0]]
for i in range(n):
    b = list(map(int, input().split()))
    a.append(b)
ansFlg = True
for i in range(1,len(a)):
    ti = a[i][0] - a[i-1][0]
    x = abs(a[i][1] - a[i-1][1])
    y = abs(a[i][2] - a[i-1][2])
    target = ti - x - y
    if (target < 0) or (target%2 != 0):
        ansFlg = False
if ansFlg:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

for i in range(n):
    t_diff = li[i+1][0] - li[i][0]
    xy_diff = sum(li[i+1][1:]) - sum(li[i][1:])

    if t_diff < xy_diff or t_diff % 2 != xy_diff % 2:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

ctime = 0
cx = 0
cy = 0
ans = True

for i in range(N):
    nt,nx,ny = Data[i]
    dist = abs(nx-cx)+abs(ny-cy)
    dtime  = nt-ctime 

    if dist > dtime or (dtime-dist) % 2 == 1:
        ans = False
        break

    ctime = nt
    cx = nx
    cy = ny

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def dist(a, b):
    dist = 0
    dist += abs(a[0] - b[0])
    dist += abs(a[1] - b[1])
    return dist

def solve(N: int, t: "List[int]", x: "List[int]", y: "List[int]"):
    txy = [[i, j, k] for i,j,k in zip(t, x, y)]
    txy = sorted(txy, key = lambda x: x[0])
    flag = 0
    coordinate_start = [0, 0]
    t_start = 0
    for t, x, y in txy:
        coordinate_goal = [x, y]
        time_to_travel = t - t_start
        distance = dist(coordinate_start, coordinate_goal)
        if distance > time_to_travel:
            flag = False
            break
        if distance <= time_to_travel:
            if (distance - time_to_travel) % 2 == 0:
                flag = True
            else:
                flag = False
                break
        t_start = t
        coordinate_start = [x, y]
    if flag == True:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    t = [int()] * (N)  # type: "List[int]"
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        t[i] = int(next(tokens))
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, t, x, y)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
t0 = 0
x0 = 0
y0 = 0
ans = True

for i in range(N):
    next = input().split()
    t = int(next[0])
    x = int(next[1])
    y = int(next[2])
    time = t - t0
    range = abs(x - x0) + abs(y - y0)

    if time < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    t0 = t
    y0 = y
    x0 = x



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

Submission status: Accepted

Solution code:
_ = int(input())
bef_time = 0
bef_x = 0
bef_y = 0
ans = True

for i in range(_):
    next = input().split()
    next_time = int(next[0])
    next_x = int(next[1])
    next_y = int(next[2])
    time = next_time - bef_time
    range = abs(next_x - bef_x) + abs(next_y - bef_y)

    if (next_time - bef_time) < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



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

Submission status: Accepted

Solution code:
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
check = True
for i in range(len(l)):
    if not((l[i][0] >= l[i][1] + l[i][2]) and (l[i][0] % 2 == ((l[i][1] + l[i][2]) % 2))):
        check = False
if check:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

a = [input().split() for l in range(n)]
for i in range(n):
    t.append(a[i][0])
    x.append(a[i][1])
    y.append(a[i][2])

for i in range(1,n+1):
    time = int(t[i])-int(t[i-1])
    next2 = int(x[i])+int(y[i])
    if time >= next2-now and (time-(next2-now))%2 == 0:
       now = int(x[i])+int(y[i])
    else:
        print('No')
        exit()
    
print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
now=0
t=[0 for i in range(n+1)]  #配列の大きさを指定
x=[0 for i in range(n+1)]
y=[0 for i in range(n+1)]

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

for i in range(1,n+1):
    time = int(t[i])-int(t[i-1])
    next2 = int(x[i])+int(y[i])
    if time >= next2-now and (time-(next2-now))%2 == 0:
       now = int(x[i])+int(y[i])
    else:
        print('No')
        exit()
    
print('Yes')

Submission status: Accepted

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

txy.insert(0,[0,0,0])
#print(txy)

for i in range(1,N+1):
  t=txy[i][0]-txy[i-1][0]
  x=abs(txy[i][1]-txy[i-1][1])
  y=abs(txy[i][2]-txy[i-1][2])
  xy=x+y
  #print(i,t,x,y)
  
  if not (t>=xy and (t-xy)%2==0):
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
n = int(input())

tarr = []
xarr = []
yarr = []

tarr.append(0)
xarr.append(0)
yarr.append(0)


for i in range(n):
    t, x, y = map(int, input().split())
    tarr.append(t)
    xarr.append(x)
    yarr.append(y)

for i in range(1, n+1):
    if (tarr[i] % 2 == 0 and (xarr[i] + yarr[i]) % 2 == 1) or (tarr[i] % 2 == 1 and (xarr[i] + yarr[i]) % 2 == 0):
        print('No')
        exit()

    if tarr[i] - tarr[i - 1] < xarr[i] + yarr[i] - xarr[i - 1] - yarr[i - 1]:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

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

d = [(T[0][0],T[0][1]+T[0][2])]
for i in range(1,n):
    d += [(T[i][0]-T[i-1][0], abs(T[i][1]-T[i-1][1]) + abs(T[i][2]-T[i-1][2]))]

for i in range(n):
    if (d[i][0]+d[i][1])%2 != 0 or d[i][0] < d[i][1]:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
N = int(input())
targets = []
for i in range(N):
    targets.append([int(x) for x in input().split()])

now = [0,0]
now_t = 0

for target in targets:
    distance = abs(now[0] - target[1]) + abs(now[1] - target[2])
    limit = target[0] - now_t
    if distance > limit :
            print("No")
            exit()
    elif (distance - limit) %2 !=0:
            print("No")
            exit()
    else:
            now[0] = target[1]
            now[1] = target[2]
            now_t  = target[0]
print("Yes")

Submission status: Accepted

Solution code:
N=int(input())
List=[list(map(int,input().split())) for i in range(N)]
ans='Yes'
for j in List:
  if (j[1]+j[2]) > j[0]:
    ans='No'
  else:
    if j[0]%2 == 0:
      if (j[1]+j[2])%2 == 1:
        ans='No'
    else:
      if (j[1]+j[2])%2 == 0:
        ans='No'
print(ans)

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

can = 1

for i in range(1, n+1):
    tm = t[i] - t[i-1]
    xm = abs(x[i] - x[i-1])
    ym = abs(y[i] - y[i-1])
    if((tm < xm+ym) or ((tm-xm+ym)%2)):
        can = 0
        break;

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

Submission status: Accepted

Solution code:
_ = int(input())
bef_time = 0
bef_x = 0
bef_y = 0
ans = True

for i in range(_):
    next = input().split()
    next_time = int(next[0])
    next_x = int(next[1])
    next_y = int(next[2])
    time = next_time - bef_time
    range = abs(next_x - bef_x) + abs(next_y - bef_y)

    if (next_time - bef_time) < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



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

Submission status: Accepted

Solution code:
N = int(input())
TXY = [list(map(int,input().split())) for _ in range(N)]
#print(TXY)
for i in range(N):
  if i == 0:
    dt = TXY[i][0]
    dx = TXY[i][1]
    dy = TXY[i][2]
  else:
    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 abs(dx) + abs(dy) > dt or (dx + dy) % 2 != dt % 2:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

if N == 1:
    if t[0][0] >= t[0][1] + t[0][2]:
        print("Yes")
    else:
        print("No")

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

Submission status: Accepted

Solution code:
n = int(input())
t_state, x_state, y_state = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(x - x_state) + abs(y - y_state)
    td = t - t_state
    if  td < d or td%2 != d%2:
        print("No")
        exit()
    t_state, x_state, y_state = t, x, y
print("Yes")

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc086/tasks/arc089_a

n = int(input())
data = [list(map(int, input().split())) for _ in range(n)]
data.insert(0, [0, 0, 0])
ans = 'Yes'

for i in range(n):
    time = data[i+1][0] - data[i][0]
    distance = abs(data[i+1][1] - data[i][1]) + abs(data[i+1][2] - data[i][2])
    if time < distance or time%2 != distance%2:
        ans = 'No'
        break

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n):
    t, x, y = [int(x) for x in input().split()]
    if (x+y) > t or (x+y+t)%2:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
time_space = [(int(x) for x in input().split()) for i in range(n)]
pos = [0,0]
for t, x, y in time_space:
    if (x+y) > t or (x+y+t)%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 t % 2 == (x+y) % 2 and t >= (x+y):
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
N=int(input())
txy=[[0,0,0]]
for i in range(0,N):
    tmp=input().split()
    tmp=[int(s) for s in tmp]
    txy.append(tmp)
cnt=0
for i in range(0,N):
    d=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    t=txy[i+1][0]-txy[i][0]
    if d <= t and (t-d)%2==0:
        cnt+=1
    else:
        break
if cnt==N:
    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 (t-x-y)%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 (x + y) > t or (x + y) % 2 != t % 2:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
n=int(input())
A=[[0,0,0]]
for i in range(n):
    a=list(map(int,input().split()))
    A.append(a)
    t=A[i+1][0]-A[i][0]
    d=abs(A[i+1][1]-A[i][1])+abs(A[i+1][2]-A[i][2])
    if t<d or (t-d)%2!=0:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
N = int(input())
pre_x = 0
pre_y = 0
pre_t = 0
for n in range(N):
  t, x, y = list(map(int, input().split()))
  length = x- pre_x + y - pre_y
  if (t - pre_t) >= length and ((t - pre_t) - length) % 2 == 0:
    continue
  else:
    print('No')
    exit(0)

print('Yes')

Submission status: Accepted

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

enable = True
for i in range(1, len(l)):
  d = abs(l[i][1]-l[i-1][1]) + abs(l[i][2]-l[i-1][2])
  delta = l[i][0]-l[i-1][0]
  if delta < d or (delta - d) % 2 != 0:
    enable = False
    break
    
if enable:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

t,x,y = 0,0,0
ans = 'Yes'
for t1,x1,y1 in A:
    dt,dx,dy = t1-t, abs(x1-x), abs(y1-y)
    if dt>=dx+dy:
        if (dt%2==0)&((dx+dy)%2==0):
            pass
        elif (dt%2==1)&((dx+dy)%2==1):
            pass
        else:
            ans = 'No'
            break
    else:
        ans = 'No'
        break
    t,x,y = t1,x1,y1
print(ans)

Submission status: Accepted

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

t,x,y = 0,0,0
ans = 'Yes'
for t1,x1,y1 in A:
    dt,dx,dy = t1-t, abs(x1-x), abs(y1-y)
    if dt%(dx+dy)==0:
        pass
    else:
        ans = 'No'
        break
    t,x,y = t1,x1,y1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
true_flg = True
list=[input() for i in range(N)]
for key, element in enumerate(list):
    t, x, y = map(int, element.split())
    if key == 0:
        a = t - (abs(x) + abs(y))
        if a < 0 or a % 2 == 1:
            true_flg = False
            break
    else:
        pre_t, pre_x, pre_y = map(int, list[key-1].split())
        a = (t - pre_t) - (abs(x - pre_x) + abs(y - pre_y))
        if a < 0 or a % 2 == 1:
            true_flg = False
            break
if true_flg:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N=int(input())

t0=0
x0=0
y0=0

ans="Yes"

for i in range(N):
    t,x,y=map(int,input().split())
    d=abs(x-x0)+abs(y-y0)
    dt=t-t0
    if not (d<=dt and (dt-d)%2==0):
        ans="No"
    t0=t
    x0=x
    y0=y

print(ans)

Submission status: Accepted

Solution code:
import sys
N = int(input())
t=[0]*(N+1)
x=[0]*(N+1)
y=[0]*(N+1)
#距離を保管する変数
dist = 0
#時間の差を保管しておくための変数
dt = 0 
#初期値を保管しておく
now_x =0
now_y =0

t[0] = 0
x[0] = now_x
y[0] = now_y
for i in range(1,N+1):
    t[i],x[i],y[i] = map(int, input().split())
    
for i in range(1,N+1):    
    #距離を計算する
    dist = abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    dt = abs(t[i] - t[i-1])
    #時間が足りないときは絶対にいけない
    if(dist > dt):
        print('No')
        sys.exit()
    else:
        #dtが偶数なら、進む距離も偶数なはず
        #その逆も然り
        if(dt %2 != dist %2):
            print('No')
            sys.exit()
    
print('Yes')

Submission status: Accepted

Solution code:
N=int(input())

t0=0
x0=0
y0=0

ans="Yes"

for i in range(N):
    t,x,y=map(int,input().split())
    d=abs(x-x0)+abs(y-y0)
    dt=t-t0
    if d>dt:
        ans="No"
    else:
        if (dt-d)%2!=0:
            ans="No"
    t0=t
    x0=x
    y0=y

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

t0=0
x0=0
y0=0

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# input number
number = int(input())

# input coordinate
result = True
current_position = (0, 0, 0)
for i in range(number):
    t, x, y = map(int, input().split())
    
    if result:
        # calc move point
        move_point = (t - current_position[0])
        
        # calc distance
        distance = abs(x - current_position[1]) + abs(y - current_position[2])
        
        # check
        if (move_point < distance) or ((move_point - distance) % 2 != 0):
            result = False
        
        # update position
        current_position = (t, x, y)

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

Submission status: Accepted

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

flag = 0
for i in range(1, n+1):
    time = t[i] - t[i-1]
    dst = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if time < dst or (time - dst) % 2 == 1:
        flag = 1
if flag:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
t_list = [0] * n
x_list = [0] * n
y_list = [0] * n
for i in range(n):
    t_list[i], x_list[i],y_list[i] = map(int, input().split())

prev_t, prev_x, prev_y = 0, 0, 0
for i in range(n):
    t, x, y = t_list[i], x_list[i], y_list[i]
    diff_t = t - prev_t
    diff_x = abs(x - prev_x)
    diff_y = abs(y - prev_y)
    remaining_t = diff_t - (diff_x + diff_y)
    if (remaining_t < 0) or (remaining_t % 2 != 0):
        print("No")
        exit()
    prev_t = t
    prev_x = x
    prev_y = y

print("Yes")

Submission status: Accepted

Solution code:
import sys

yomikomi_kaisuu = int(input())
no_hantei = 0

for i in range(yomikomi_kaisuu):
#    print(str(i))
    input_list = input().split()
    jikoku = int(input_list[0])
    x_ = int(input_list[1])
    y_ = int(input_list[2])
    if jikoku < x_ + y_:
        no_hantei = no_hantei + 1
#        print("a")
    elif jikoku %2 == 0 and (x_ + y_) % 2 == 1:
        no_hantei = no_hantei + 1
#        print("b")
    elif jikoku %2 == 1 and (x_ + y_) % 2 == 0:
        no_hantei = no_hantei + 1
#        print("c")

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

Submission status: Accepted

Solution code:
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]
txy.sort(key=lambda x: x[0])
now = 0, 0, 0
for t, x, y in txy:
    dist = x - now[1] + y - now[2]
    if not (t - now[0] >= dist and (t - now[0]) % 2 == dist % 2):
        print("No")
        break
    now = t, x, y
else:
    print("Yes")

Submission status: Accepted

Solution code:
N = int(input())

t_prev = 0
x_prev = 0
y_prev = 0

ans = "Yes"

for i in range(N):
  t_now, x_now, y_now = map(int, input().split())
  t_diff = abs(t_now - t_prev)
  x_diff = abs(x_now - x_prev)
  y_diff = abs(y_now - y_prev)
  
  t_prev = t_now
  x_prev = x_now
  y_prev = y_now
  
  if t_diff < x_diff + y_diff:
    ans = "No"
    
  if t_diff % 2 != (x_diff + y_diff) % 2:
    ans = "No"
    
print(ans)

Submission status: Accepted

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

for pol in txy:
    dist = abs(pol[1]) + abs(pol[2])
    
    if(dist > pol[0]): result = False
    if(dist % 2 != pol[0] % 2): result = False

print(("No", "Yes")[result])

Submission status: Accepted

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

for i in range(N):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    
    if(dist > dt): result = False
    if(dist % 2 != dt % 2): result = False

print(("No", "Yes")[result])

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

Submission status: Accepted

Solution code:
N = int(input())

t_b = x_b = y_b = 0 # 直前の時刻と位置保存用

def dist(x, x_b, y, y_b):
    return abs(x-x_b) + abs(y-y_b)

miss_flg = 0

for i in range(N):
    t, x, y = map(int, input().split())
    if dist(x, x_b, y, y_b) > t - t_b or ((t - t_b) + dist(x, x_b, y, y_b))% 2 == 1: # 到達不能もしくは距離と残り時間の偶奇が不一致
        miss_flg = 1
    t_b, x_b, y_b = t, x, y

print("Yes" if miss_flg == 0 else "No")

Submission status: Accepted

Solution code:
n = int(input())
breaker = 0
for s in range(n):
	a = [int(i) for i in input().split()]
	tour = a[1] + a[2]
	if tour > a[0]:
		breaker += 1
	elif tour % 2 != a[0] % 2:
		breaker += 1
	if breaker != 0:
		print("No")
		break
if breaker == 0:
	print("Yes")

Submission status: Accepted

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

now = [0,0,0]  # [t,x,y]
for t,x,y in Q:
  dt = t-now[0]
  dxy = abs(now[1]-x) + abs(now[2]-y)
  if dt >= dxy and dt%2 == dxy%2:
    now = [t,x,y]
  else:
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
# ABC086 C - Traveling
import numpy as np
n = int(input())
l = [list(map(int,input().split())) for _ in range(n)]

if n == 1:
    if l[0][0] >= l[0][1]+l[0][2]:
        if l[0][0]%2 == (l[0][1]+l[0][2])%2:
            pass
        else:
            print('No')
            exit()    
    else:
        print('No')
        exit()
for i in range(n-1):
    t = l[i+1][0]-l[i][0]
    x = abs(l[i+1][1]-l[i][1])
    y = abs(l[i+1][2]-l[i][2])
    if t >= x+y:
        if t%2 == (x+y)%2:
            pass
        else:
            print('No')    
            exit()
    else:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())
        txy = [list(map(int, input().split())) for _ in range(N)]

        t, x, y = 0, 0, 0

        for next in txy:
            time = next[0] - t
            x_d = abs(next[1] - x)
            y_d = abs(next[2] - y)
            if x_d + y_d > time or (x_d + y_d) % 2 != time % 2:
                print('No')
                exit()
            t, x, y = next

        print('Yes')


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Accepted

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

for i in range(N):
    time = txy[i + 1][0] - txy[i][0]
    length = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    if time >= length and time % 2 == length % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    TXY = [[0,0,0]]
    for i in range(N):
        tmp = list(map(int,input().split()))
        TXY.append(tmp)
    TXY = sorted(TXY)
    flag = 0
    
    for i in range(N):
        dt = TXY[i+1][0] - TXY[i][0]
        dx = TXY[i+1][1] - TXY[i][1]
        dy = TXY[i+1][2] - TXY[i][2]
        if not (abs(dt)%2 == (abs(dx)+abs(dy))%2 and abs(dt) >= abs(dx)+abs(dy)):
            flag = 1
            break
            
    if flag == 1:
        print("No")
    else:
        print("Yes")

    
    
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
li=[list(map(int,input().split())) for _ in range(N)]
li.insert(0,[0,0,0])
ans="Yes"
for i in range(N):
  if li[i+1][0]-li[i][0]<abs(li[i+1][1]-li[i][1])+abs(li[i+1][2]-li[i][2]) or (li[i+1][0]-li[i][0])%2!=abs(li[i+1][1]-li[i][1]+li[i+1][2]-li[i][2])%2:
    ans="No"
print(ans)

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())
    T.append(t)
    X.append(x)
    Y.append(y)

for i in range(1, N+1):
    if abs(T[i-1] - T[i]) < abs(X[i-1] - X[i]) + abs(Y[i-1] - Y[i]):
        print('No')
        exit()
    else:
        if T[i] % 2 != 0 and (X[i]+Y[i]) % 2 == 0:
            print('No')
            exit()
        elif T[i] % 2 == 0 and (X[i]+Y[i]) % 2 != 0:
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
import sys
n = int(input())
t = []; x = []; y = []
for i in range(n):
    tmp_t, tmp_x, tmp_y = map(int, input().split())
    t.append(tmp_t)
    x.append(tmp_x)
    y.append(tmp_y)

if n == 1:
    if x[0] + y[0] == 1:
        print("Yes")
    else:
        print("No")
    sys.exit(0)

prex, prey, pre_t = 0, 0, 0
for i in range(n):
    m = abs(x[i] - prex) + abs(y[i] - prey)
    time = t[i] - pre_t
    if m <= time and m % 2 == time % 2:
        prex, prey, pre_t = x[i], y[i], t[i]
    else:
        print("No")
        break

else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
ans = "Yes"
tpre, xpre, ypre = 0, 0, 0
for _ in range(n):
    t, x, y = na()
    move = abs(x - xpre) + abs(y - ypre) 
    time = (t - tpre)
    if move <= time and move % 2 == time % 2:
        continue
    else:
        ans = "No"

    tpre, xpre, ypre = t, x, y
print(ans)

Submission status: Accepted

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

    now = [0, 0, 0]
    flg = True
    for t, x, y in data:
        dt = t - now[0]
        dx = abs(x-now[1])
        dy = abs(y-now[2])
        
        if dt == dx + dy or ((dt >= (dx + dy))and(dt - (dx + dy)) % 2 == 0):
            now[0] = t
            now[1] = x
            now[2] = y
        
        else:
            flg = False
            break
    
    if flg:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    func()

Submission status: Accepted

Solution code:
N = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(N):
    T, X, Y = map(int, input().split())
    t.append(T)
    x.append(X)
    y.append(Y)
    
bool = True
for i in range(N):
    dt = t[i+1]-t[i]
    dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if dt < dist:
        bool = False
    elif dist%2 != dt%2:
        bool = False
        
if bool == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
for _ in[0]*int(input()):
	t,x,y=map(int,input().split())
	if(t+x+y)%2+(t<x+y):print("No");exit()
print("Yes")

Submission status: Accepted

Solution code:
def solve():
	_,*l=map(int,open(0).read().split())
	print("YNeos"[any((t+x+y)%2+(t<x+y)for t,x,y in zip(*[iter(l)]*3))::2])

if __name__=="__main__":
	solve()

Submission status: Accepted

Solution code:
_,*l=map(int,open(0).read().split());print("YNeos"[any((t+x+y)%2+(t<x+y)for t,x,y in zip(*[iter(l)]*3))::2])

Submission status: Accepted

Solution code:
n,*l=map(int,open(0).read().split());print("YNeos"[any((i+j+k)%2+(i<j+k)for i,j,k in zip(*[iter([abs(i-j)for i,j in zip([0,0,0]+l,l)])]*3))::2])

Submission status: Accepted

Solution code:
n=int(input())
t_l,x_l,y_l=[0],[0],[0]
for i in range(n):
    t,x,y=map(int,input().split())
    t_l.append(t)
    x_l.append(x)
    y_l.append(y)

for i in range(n):
    a = (t_l[i+1]-t_l[i]) - (abs(x_l[i+1]-x_l[i]) + abs(y_l[i+1]-y_l[i]))
    if a<0 or a%2!=0:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
txy = [[0,0,0]] + [list(map(int, input().split())) for _ in range(n)]
for i in range(1,n+1):
  dist = abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) 
  diffTime = txy[i][0] - txy[i-1][0]
  if not (diffTime >= dist and abs(diffTime - dist) % 2 == 0):
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
N = int(input())

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

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

isCan = True

for i in range(N):
    dt = t[i+1] - t[0]
    dx = x[i+1] - x[0]
    dy = y[i+1] - y[0]
    dgrid = abs(dx) + abs(dy)
    test = dt - dgrid
    if test < 0:
        isCan = False
        break
    elif test % 2 == 0:
        isCan = True
    else:
        isCan = False
        break

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

Submission status: Accepted

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

def solve() :
    pt, px, py = 0, 0, 0
    for t, x, y in txy :
        dd = abs(x-px) + abs(y-py)
        dt = t - pt
        if dd > dt or dd % 2 != dt % 2 :
            return 'No'
            
        pt, px, py = t, x, y
        
    return 'Yes'
    
print(solve())