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:
n = int(input())

t_list = list()
x_list = list()
y_list = list()

for a in range(n):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)

ans = True

for a in range(1, n):
    dt = t_list[a] - t_list[a-1]
    dx = x_list[a] - x_list[a-1]
    dy = y_list[a] - y_list[a-1]

    if abs(dx) + abs(dy) <= dt:
        if (dx + dy) % 2 == dt % 2:
            ans = True
        else:
            ans = False
            break
    else:
        ans = False
        break

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

Submission status: Wrong Answer

Solution code:
n = int(input())

t_list = list()
x_list = list()
y_list = list()

for a in range(n):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)

ans = False

for a in range(1, n):
    dt = t_list[a] - t_list[a-1]
    dx = x_list[a] - x_list[a-1]
    dy = y_list[a] - y_list[a-1]

    if abs(dx) + abs(dy) <= dt:
        if (dx + dy) % 2 == dt % 2:
            ans = True
        else:
            ans = False
            break
    else:
        ans = False
        break

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

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
px=0
py=0
pt=0
for i in range(n):
    t,x,y=map(int,input().split())
    if abs(x-px)+abs(y-py)>t-pt or abs(x-px)+abs(y-py)%2!=(t-pt)%2:
        print('No')
        sys.exit()
    else:
        px=x
        py=y
        pt=t
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
px=0
py=0
pt=0
for i in range(n):
    t,x,y=map(int,input().split())
    if abs(x-px)+abs(y-py)>t-pt or abs(x-px)+abs(y-py)%2!=(t-pt)%2:
        print('No')
        sys,exit()
    else:
        px=x
        py=y
        pt=t
print('Yes')

Submission status: Wrong Answer

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

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

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 dist>dt:
        break
    else:
        pass
    if dist%2==dt%2:
        pass
    else:
        break
    count+=1
if count==N:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S=input()

reverse_S=S[::-1]

while True:
    if (reverse_S.find('maerd')==0 or
        reverse_S.find('esare')==0
        ):
        reverse_S=reverse_S[5:]

    elif reverse_S.find('remaerd')==0:
        reverse_S=reverse_S[7:]
        
    elif reverse_S.find('resare')==0:
        reverse_S=reverse_S[6:]

    else:
        break

if len(reverse_S)==0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
N = int(input())


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


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

# 最短距離にかかる time + 2 * i ならいける

Submission status: Wrong Answer

Solution code:
N = int(input())


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


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

# 最短距離にかかる time + 2 * i ならいける

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
flag = True
for i in range(N):
    t,x,y = map(int,input().split())
    if t < x+y:
        flag = False
    if t%2 != 0 and (x+y)%2 == 0:
        flag = False
    elif t%2 == 0 and (x+y)%2 != 0:
        flag = False

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

n = iinput()
txy = np.array([iarr() for i in range(n)])
t,x,y = txy.T[0], txy.T[1], txy.T[2]

flag = 0 if t[0] < abs(x[0]) + abs(y[0]) else 1
for i in range(n-1):
    dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    time = abs(t[i+1] - t[i])
    if time < dist: flag = 0; break
    if (t[i] - dist)%2 == 1: flag = 0; break

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

n = iinput()
txy = np.array([iarr() for i in range(n)])
t,x,y = txy.T[0], txy.T[1], txy.T[2]

flag = 1
for i in range(n):
    dist = x[i] + y[i]
    if t[i] < dist: flag = 0; break
    if (t[i] - dist)%2 == 1: flag = 0; break

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

Submission status: Wrong Answer

Solution code:

ii = input()
ii = int(ii)
la = []
for jj in range(ii):
    la.append(input())

flag = 1
for ss in la:
    t, x, y = ss.split(" ")
    t = int(t)
    x = int(x)
    y = int(y)
    
    if t < (x + y):
        flag = 0
        break
    else:
        if t == (x + y):
            continue
        else:
            if (x + y - t)%2:
                flag = 0
                break

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

Submission status: Wrong Answer

Solution code:
ii = input()
ii = int(ii)
la = []
for jj in range(ii):
    la.append(input())

flag = 1
for ss in la:
    t, x, y = ss.split(" ")
    t = int(t)
    x = int(x)
    y = int(y)
    
    if t < (x + y):
        print("No")
        flag = 0
        break
    elif (x + y - t)%2:
        print("No")
        flag = 0
        break

if flag:
    print("Yes")

Submission status: Wrong Answer

Solution code:
def solve(n, t_list):

    px = 0
    py = 0
    pt = 0
    ans = "Yes"
    for t, x, y in t_list:
        d = abs(x-px) + abs(y-py)
        dt = t - pt
        if (d %2 and dt % 2) and dt >= d:
            px = x
            py = y
            pt = t
        else:
            ans = "No"
            break

    return ans


if __name__ == "__main__":
    n = int(input())
    t_list = [[int(j) for j in input().split()] for i in range(n)]
    print(solve(n, t_list))

Submission status: Wrong Answer

Solution code:
def solve(n, t_list):

    px = 0
    py = 0
    pt = 0
    ans = "Yes"
    for t, x, y in t_list:
        d = abs(x-px) + abs(y-py)
        if ((d %2 == 0 and (t-pt) % 2 == 0) or (d % 2 == 1 and (t-pt) %2 == 1) )and t >= d:
            px = x
            py = y
            pt = t
        else:
            ans = "No"
            break

    return ans


if __name__ == "__main__":
    n = int(input())
    t_list = [[int(j) for j in input().split()] for i in range(n)]
    print(solve(n, t_list))

Submission status: Wrong Answer

Solution code:
def solve(n, t_list):

    px = 0
    py = 0
    pt = 0
    ans = "Yes"
    for t, x, y in t_list:
        d = abs(x-px) + abs(y-py)
        if d == 0 and (t-pt) % 2 == 0 or d != 0 and (t-pt) >= d:
            px = x
            py = y
            pt = t
        else:
            ans = "No"
            break

    return ans


if __name__ == "__main__":
    n = int(input())
    t_list = [[int(j) for j in input().split()] for i in range(n)]
    print(solve(n, t_list))

Submission status: Wrong Answer

Solution code:
# C - Traveling
N = int(input())
T = []
for n in range(N):
    T.append([int(i) for i in input().split()])
now_t = 0
now_x = 0
now_y = 0
cnt=0
for t in T:
    if t[0]%2 !=(t[1]+t[2])%2:
        print('No')
        exit()
        
    if t[0] -now_t >=min(t[1]-now_x,t[2]-now_y):
        now_t = t[0]
        now_x = t[1]
        now_y = t[2]
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import numpy as np

Submission status: Wrong Answer

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

# dt = ti+1 −ti
# dist = abs(xi+1 − xi)+abs(yi+1 − yi)

# キーポイント: パリティ
# x + y は毎秒ごとに必ず偶奇が入れ替わる。

n = int(input())

T = 0
X = 0
Y = 0

cnt = 0

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

    if abs(X-x) + abs(Y-y) <= (T-t) and (x+y)%2 == t%2:
        cnt += 1
    T,X,Y = t,x,y
print("Yes" if cnt == n else "No")

Submission status: Wrong Answer

Solution code:
N=int(input())
t=[]
x=[]
y=[]
#t.append(0)
#x.append(0)
#y.append(0)
t_cur=0
x_cur=0
y_cur=0

for i in range(N):
  plan=input().split(' ')
  t.append(int(plan[0]))
  x.append(int(plan[1]))
  y.append(int(plan[2]))

for i in range(N):
  t_gap=t[i]-t_cur
  x_gap=x[i]-x_cur
  y_gap=y[i]-y_cur

  dist=x_gap+y_gap

#  print("trip=",t[i],x[i],y[i])
#  print("t_gap=",t_gap)
#  print("dist=",dist)
  if (t_gap-dist)>=0 and (t_gap-dist)%2==0:
    t_cur=t[i]
    x_cur=x[i]
    y_cur=y[i]
  else:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range (N):
    t, x, y = map(int, input().split())
    dt = t - pt
    dxy = x-px+y-py
    if dxy > dt or (dxy - dt)%2:
        print("No")
        exit()
    pt, px, py = t, x, y
print("Yes")

Submission status: Wrong Answer

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

for i in range (N):
    t, x, y = map(int, input().split())
    dt = t - pt
    dxy = x-px+y-py
    if dxy > dt or dxy%2 != dt%2:
        print("No")
        exit()
    pt, px, py = t, x, y
print("Yes")

Submission status: Wrong Answer

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

cnt = 0
while cnt < N:
    dt = t[cnt+1]-t[cnt]
    dxy = x[cnt+1]+y[cnt+1]-x[cnt]-y[cnt]
    
    if dxy > dt or dt%2 != dxy%2:
        print("No")
        exit()
        
    cnt += 1
else:
    print("Yes")

Submission status: Wrong Answer

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

cnt = 0
while cnt < N:
    dt = t[cnt+1]-t[cnt]
    dxy = x[cnt+1]+y[cnt+1]-x[cnt]-y[cnt]
    
    if dxy > dt or dt%2 != dxy%2:
        print("No")
        break
        
    cnt += 1
else:
    print("Yes")

Submission status: Wrong Answer

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

cnt = 0
while cnt < N:
    if cnt == 0:
        if ((t[cnt])%2 != (x[cnt]+y[cnt])%2) or (t[cnt]<(x[cnt]+y[cnt])):
            print("No")
            break
    elif cnt != 0:
        if ((t[cnt]-t[cnt-1])%2 != (x[cnt]+y[cnt]-x[cnt-1]-y[cnt-1])%2) or ((t[cnt]-t[cnt-1]) < (x[cnt]+y[cnt]-x[cnt-1]-y[cnt-1])):
            print("No")
            break
    cnt += 1
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
import sys
l=[list(map(int,input().split())) for i in range(N)]
if l[0][0] != l[0][1] + l[0][2]:
   print("No")
   exit()
for i in range(N-1):
   if abs(l[i][0]-l[i+1][0]) > abs(l[i][1]-l[i+1][1])+abs(l[i][2]-l[i+1][2]):
      if (abs(l[i][0]-l[i+1][0])-abs(l[i][1]-l[i+1][1])-abs(l[i][2]-l[i+1][2]))%2==0:
         pass
      else:
         print("No")
         exit()
   else:
      print("No")
      exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
a,b,c=0,0,0
for i in range(n):
    t,x,y = map(int, input().split())
    sa = t-a
    if sa<abs(x-b)+abs(y-c):
        print("No")
        exit()
    else:
        tw = sa-abs(x-b)-abs(y-c)
        if tw%2!=0:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
a,b,c=0,0,0
for i in range(n):
    t,x,y = map(int, input().split())
    sa = t-a
    if sa<x+y:
        print("No")
        exit()
    else:
        tw = sa-x-y
        if tw%2!=0:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0]*100001
x = [0]*100001
y = [0]*100001
for n in range(N):
    t[n+1], x[n+1], y[n+1] = map(int, input().split())
ans = True
for n in range(1, N):
    dt   = t[n+1] - t[n]
    dist = (x[n+1] - x[n]) + (y[n+1] - y[n])
    if dt < dist:
        ans = False
    if dt % 2 != dist % 2:
        ans = False
if ans:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0]*100001
x = [0]*100001
y = [0]*100001
for n in range(N):
    t[n+1], x[n+1], y[n+1] = map(int, input().split())
ans = True
for n in range(N):
    dt   = t[n+1] - t[n]
    dist = (x[n+1] - x[n]) + (y[n+1] - y[n])
    if dt < dist:
        ans = False
    if dt % 2 != dist % 2:
        ans = False
if ans:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

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

    for i in range(n):
        t_diff = abs(T[i+1]-T[i])
        x_diff = abs(X[i+1]-X[i])
        y_diff = abs(Y[i+1]-Y[i])
        if abs(x_diff + y_diff - t_diff) % 2 == 1 or x_diff+x_diff-t_diff>0:
            print('No')
            return
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

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

    for i in range(n):
            x_diff = abs(X[i+1]-X[i])
            y_diff = abs(Y[i+1]-Y[i])
            t_diff = abs(T[i+1]-T[i])
            if abs(x_diff + y_diff - t_diff) % 2 != 0 or x_diff+x_diff-t_diff>0:
                print('No')
                return
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

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

    for i in range(n):
        if i == 0:
            if (X[0]+Y[0]-T[0]) % 2 != 0 or X[0]+Y[0]-T[0] > 0:
                print('No')
                return
        else:
            x_diff = abs(X[i]-X[i-1])
            y_diff = abs(Y[i]-Y[i-1])
            t_diff = abs(T[i]-T[i-1])

            if abs(x_diff + y_diff - t_diff) % 2 != 0 or x_diff+x_diff-t_diff>0:
                print('No')
                return
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
tn,xn,yn=0,0,0
judge=[]
for i in range(N):
    t1,x1,y1=map(int,input().split())
    td=t1-tn
    xd=x1-xn
    yd=y1-yn
    if t1%2==(x1+y1)%2 and td>=xd+yd:
        judge.append(True)
    else:
        judge.append(False)

    tn,xn,yn=t1,x1,y1
print('Yes' if all(judge) else 'No')

Submission status: Wrong Answer

Solution code:
N=int(input())
tn,xn,yn=0,0,0
judge=[]
for i in range(N):
    t1,x1,y1=map(int,input().split())
    td=t1-tn
    xd=x1-xn
    yd=y1-yn
    if td%2==(xd+yd)%2 and td>=xd+yd:
        judge.append(True)
    else:
        judge.append(False)

    tn,xn,yn=t1,x1,y1
print('Yes' if all(judge) else 'No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
txy = [LIST() for _ in range(N)]
txy.insert(0, [0, 0, 0])

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%2 == (dx+dy)%2 and dt >= dx+dy:
		continue
	else:
		print("No")
		break
else:
	print("Yes")

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
txy = [LIST() for _ in range(N)]

for t, x, y in txy:
	if t%2 == (x+y)%2 and t >= x+y:
		continue
	else:
		print("No")
		break
else:
	print("Yes")

Submission status: Wrong Answer

Solution code:
t = []

N = input()

for i in range(int(N)):
    t.append(list(map(int, input().split())))
    
t.sort()

co, co_ = [0, 0, 0], [0, 0, 0]
flag = 1

for i in range(len(t)):
    co_[0] = t[i][0] - co[0]
    print(co,co_)
    co_[1] = t[i][1] - co[1]
    print(co,co_)
    co_[2] = t[i][2] - co[2]
    print(co,co_)
    dis = abs(co_[1]) + abs(co_[2])
    print(co,co_,dis)
    if dis % 2 != (t[i][0]-co[0]) % 2:
        flag = 0
        break
    elif dis > co_[0]:
        flag = 0
        break
        
    co = t[i]
    
if flag == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

tf = 0
i = 0
a = grid[i][0]
b = grid[i][1]
c = grid[i][2]
s = a-(b+c)
if (a >= abs(b)+abs(c) and s % 2 == 0):
  tf += 1

i = 1
while i == N-1:
  a = grid[i][0]-grid[i-1][0]
  b = grid[i][1]-grid[i-1][1]
  c = grid[i][2]-grid[i-1][2]
  s = a-(b+c)
  if (a >= abs(b)+abs(c) and s % 2 == 0):
    tf += 1
  i += 1


if (tf == N):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
f = True
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or (dist%2 != time%2):
        f = False    
print('Yes' if f else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
f = True
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or dist%2 != time%2:
        f = False    
print('Yes' if f else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
f = True
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or (time-dist)%2==1:
        f = False
        break       
print('Yes' if f else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
f = True
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or dist%2 != time%2 or dist == 0:
        f = False
        break       
print('Yes' if f else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
f = True
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or dist%2 != time%2:
        f = False
        break       
print('Yes' if f else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
m = 0
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if time == 0:
      m = 1
      break
    if dist>time:
      m = 1
      break
    if dist%2 != time%2:
      m = 1
      break
print('Yes' if m==0 else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
m = 0
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time:
      m = 1
      break
    if dist%2 != time%2:
      m = 1
      break
print('Yes' if m==0 else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
m = 0
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time:
        m = 1
        break
    if dist%2 == time%2: 
        continue
print('Yes' if m==0 else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
m = 0
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time:
        m = 1
        break
    else:
        if dist%2 == time%2: 
            continue
print('Yes' if m==0 else 'No')

Submission status: Wrong Answer

Solution code:
import numpy as np
n=int(input())
t=[]
x=[]
y=[]
for _ in range(n):
    li=list(map(int,input().split()))
    t.append(li[0])
    x.append(li[1])
    y.append(li[2])
#print(n)
#print(t)
#print(x[0])
#print(y[0])


#a=np.zeros((10**5,10**5),dtype=int)
#a[x[0]-1][y[0]-1]=1
#print(a)

flg=0
for i in range(n):
    if i==0:
        if x[i]+y[i]<=t[i]:
            if(x[i]+y[i])%2 == t[i]%2:
                continue
            else:
                flg+=1
        else:
            flg+=1
    else:
        if x[i]+y[i]-x[i-1]-y[i-1] <= t[i]-t[i-1]:
            if(x[i]+y[i]-x[i-1]-y[i-1])%2 == (t[i]-t[i-1])%2:
                continue
            else:
                flg+=1
        else:
            flg+=1

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

Submission status: Wrong Answer

Solution code:
N = int(input())
time_coor = []
for n in range(N):
    if n==0:
        time_coor.append([0, 0, 0])
    else:
        time_coor.append(list(map(int, input().split())))

can = True
for n in range(N-1):
    dist = abs(time_coor[n+1][1]-time_coor[n][1]) + \
           abs(time_coor[n+1][2]-time_coor[n][2])
    time = time_coor[n+1][0]-time_coor[n][0]
    if dist>time:
        can = False
        break
    elif dist%2==time%2:
        continue
    else:
        can = False
        break
    

if can==True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

can = True
for n in range(N-1):
    dist = abs(time_coor[n+1][1]-time_coor[n][1]) + \
           abs(time_coor[n+1][2]-time_coor[n][2])
    if dist>(time_coor[n+1][0]-time_coor[n][0]):
        can = False
        break
    elif dist%2==(time_coor[n+1][0]-time_coor[n][0])%2:
        continue
    

if can==True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

can = True
for n in range(N-1):
    dist = abs(time_coor[n+1][1]-time_coor[n][1]) + \
           abs(time_coor[n+1][2]-time_coor[n][2])
    if dist>time_coor[n][0]:
        can = False
        break
    elif dist%2==(time_coor[n+1][0]-time_coor[n][0])%2:
        continue
    

if can==True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

can = True
for n in range(N-1):
    dist = abs(time_coor[n][1]-time_coor[n+1][1]) - \
           abs(time_coor[n][2]-time_coor[n+1][2])
    if dist>time_coor[n][0]:
        can = False
        break
    elif dist%2==(time_coor[n+1][0]-time_coor[n][0])%2:
        continue
    

if can==True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

can = True
for n in range(N-1):
    if (abs(time_coor[n+1][1])-abs(time_coor[n][1]) + abs(time_coor[n+1][2])-abs(time_coor[n][2]))!=1:
        can = False
        break
    else:
        continue

if can==True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
x_before = 0
y_bfefore =0
t_before = 0

for point in jorney:
    t = point[0]
    x = point[1]
    y = point[2]
    distance = x- x_before + y - y_bfefore
    interval = t - t_before
    
    
    if t %2 == (x+y)%2 and interval >= distance:
        t_before=t
        x_before=x
        y_bfefore=y

        continue
    else:
        flg=False
        break
if flg:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
x_before = 0
y_bfefore =0
t_before = 0

for point in jorney:
    t = point[0]
    x = point[1]
    y = point[2]
    distance = x- x_before + y - y_bfefore
    interval = t - t_before
    
    
    if t %2 == (x+y)%2 and interval >= distance:
        t_before=t
        x_before=x
        y_bfefore=y

        continue
    else:
        flg=False
        break
if flg:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
for point in jorney:
    time = point[0]
    x = point[1]
    y = point[2]
    if time %2 == (x+y)%2 and time>= x+y:
        continue
    else:
        flg=False
        break
if flg:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input())

time = 0
visited = [0, 0]
result = []

for i in range(N):
    t, *xy = map(int, input().split())
    diff_time = t - time
    diff_dist = sum([abs(xy[i] - visited[i]) for i in range(2)])
    if (diff_dist <= diff_time) & (((diff_time - diff_dist) % 2)==0):
        result.append(True)
    else:
        result.append(False)

print("Yes") if all(result) else print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
 
result = []
 
for i in range(n):
    t, x, y = map(int, input().split())
 
    if t % 2 == 0:
        result.append(True) if ((x + y) % 2 == 0) & (t >= x + y) else result.append(False)
    else:
        result.append(True) if ((x + y) % 2 == 1) & (t >= x + y) else result.append(False)
 
print("Yes" if all(result) else "No")

Submission status: Wrong Answer

Solution code:
# ABC086 C Traveling

n = int(input())
t, x, y = 0, 0, 0
flag = True

for i in range(n):
    _t,_x,_y = map(int, input().split())
    _d = abs(x - _x) + abs(y - _y)
    _dt = abs(t - _t)
    if _d > _dt or ((_d - _dt)%2) == 1:
        flag = False
    t,x,y = _t,_x,_y

if flag:
    print("YES")
else:
    print("NO")