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

s_x = 0
s_y = 0
s_t = 0

for i in range(n):
    t = t_li[i][0] - s_t
    x = t_li[i][1]
    y = t_li[i][2]
    
    s = abs(x-s_x)+abs(y-s_y)
    
    if s > t or (t-s)%2 == 1:
        print("No")
        exit()
        
    s_x = x
    s_y = y
    s_t = t
        
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

    # violation case1: distance is more than time
    if x + y > t:
        flag = 0

    # validation case2: t has to be odd if x + y is odd, and vice versa for even number
    if (t + x + y) % 2 != 0:
        flag = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

    # violation case1: distance is more than time
    if x + y > t:
        flag = 0

    # validation case2: t has to be odd if x + y is odd, and vice versa for even number
    if t + x + y % 2 != 0:
        flag = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

    # violation case1: distance is more than time
    if x + y > t:
        print("No")
        flag = 0

    # validation case2: t has to be odd if x + y is odd, and vice versa for even number
    if t + x + y % 2 != 0:
        print("No")
        flag = 0

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

Submission status: Wrong Answer

Solution code:
N=int(input())
T=[0]
X=[0]
Y=[0]
ct,cx,cy=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for j in range(1,N+1):
  ct=ct+abs(X[j]-cx)+abs(Y[j]-cy)
  cx=X[j]
  cy=Y[j]
  
  if T[j]>ct and (T[j]-ct)%2!=0:
    print("No")
    break
  elif T[j]<ct:
    print("No")
    break
  else:
    ct=T[j]
if ct==T[N]:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
T=[0]
X=[0]
Y=[0]
ct,cx,cy=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for j in range(1,N+1):
  ct=ct+abs(X[j]-cx)+abs(Y[j]-cy)
  print(ct)
  cx=X[j]
  cy=Y[j]
  
  if T[j]>ct and (T[j]-ct)%2!=0:
    print("No")
    break
  elif T[j]<ct:
    print("No")
    break
  else:
    ct=T[j]
if ct==T[N]:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
T=[0]
X=[0]
Y=[0]
ct,cx,cy=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for j in range(1,N+1):
  ct=ct+abs(X[j]-cx)+abs(Y[j]-cy)
  cx=X[j]
  cy=Y[j]
  
  if T[j]>ct and (T[j]-ct)%2!=0:
    print("No")
    break
  elif T[j]<ct:
    print("No")
    break
  else:
    ct=T[j]
if ct==T[N]:
  print("Yes")
elif T[j]>ct and (T[j]-ct)%2==0:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
T=[0]
X=[0]
Y=[0]
ct,cx,cy=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for j in range(1,N+1):
  ct=ct+abs(X[j]-cx)+abs(Y[j]-cy)
  cx=X[j]
  cy=Y[j]
  
  if T[j]>ct and (T[j]-ct)%2!=0:
    print("No")
    break
  elif T[j]<ct:
    print("No")
    break
if ct==T[N]:
  print("Yes")
elif T[j]>ct and (T[j]-ct)%2==0:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
T=[0]
X=[0]
Y=[0]
ct,cx,cy=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for j in range(1,N+1):
  ct=ct+abs(X[j]-cx)+abs(Y[j]-cy)
  cx=X[j]
  cy=Y[j]
  
  if T[j]>ct and (T[j]-ct)%2!=0:
    print("No")
    break
  elif T[j]<ct:
    print("No")
    break
if ct==T[N]:
  print("Yes")
elif (T[j]-ct)%2==0 and T[j]>ct:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
T=[0]
X=[0]
Y=[0]
ct,cx,cy=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for j in range(1,N+1):
  ct=ct+abs(X[j]-cx)+abs(Y[j]-cy)
  cx=X[j]
  cy=Y[j]
  
  if T[j]>ct and (T[j]-ct)%2!=0:
    print("No")
    break
  elif T[j]<ct:
    print("No")
    break
if ct==T[N]:
  print("Yes")
elif (T[j]-ct)%2==0 and T[j]>=ct:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
T=[0]
X=[0]
Y=[0]
ct,cx,cy=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for j in range(1,N+1):
  ct=ct+abs(X[j]-cx)+abs(Y[j]-cy)
  cx=X[j]
  cy=Y[j]
  if cx<0 or cy<0:
    print("No")
    break
  #print(T[j],ct)
  if T[j]>ct and (T[j]-ct)%2!=0:
    print("No")
    break
  elif T[j]<ct:
    print("No")
    break
if ct==T[N]:
  print("Yes")
elif (T[j]-ct)%2==0 and T[j]>ct:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = []
for i in range(N):
    txy.append(list(map(int,input().split())))
ans = "YES"
t = 0
x = 0
y = 0
for i in range(N):
    deft = txy[i][0] - t
    defx = abs(txy[i][1] - x)
    defy = abs(txy[i][2] - y)
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    if (defx + defy) > deft:
        ans = "NO"
        break
    elif (deft - defx - defy)%2 != 0:
        ans = "NO"
        break
if ans == "NO":
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = []
for i in range(N):
    txy.append(list(map(int,input().split())))
ans = "YES"
t = 0
x = 0
y = 0
for i in range(N):
    deft = txy[i][0] - t
    defx = abs(txy[i][1] - x)
    defy = abs(txy[i][2] - y)
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    if (defx + defy) > deft:
        ans = "NO"
        break
    elif (deft - defx - defy)%2 != 0:
        ans = "NO"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = []
for i in range(N):
    txy.append(list(map(int,input().split())))
ans = "YES"
t = 0
x = 0
y = 0
for i in range(N):
    deft = txy[i][0] - t
    defx = abs(txy[i][1] - x)
    defy = abs(txy[i][2] - y)
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    if (defx + defy) > deft:
        ans = "NO"
        break
    elif (deft - defx - defy)%2 != 0:
        ans = "NO"
        break
    else:
        continue
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
T=[0]
X=[0]
Y=[0]
ct,cx,cy=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for j in range(1,N+1):
  ct=ct+abs(X[j]-cx)+abs(Y[j]-cy)
  cx=X[j]
  cy=Y[j]
  #print(T[j],ct)
  if T[j]>ct and (T[j]-ct)%2!=0:
    print("No")
    break
  elif T[j]<ct:
    print("No")
    break
if ct==T[N]:
  print("Yes")
elif (T[j]-ct)%2==0 and T[j]>ct:
  print("Yes")

Submission status: Wrong Answer

Solution code:
x0 = 0
y0 = 0
t0 = 0
t, x, y = [], [], []
N = input()
flg = True
for i in range(int(N)):
    t, x, y = map(int, input().split())
    t0 = t - t0
    if (x - x0 != 0) | (y - y0) != 0:
        x0 = abs(x - x0)
        y0 = abs(y - y0)
    else:
        flg = False
    if t0 < x0 + y0: flg = False

if flg:
    print('yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
x0 = 0
y0 = 0
t0 = 0
t, x, y = [], [], []
N = input()
flg = True
for i in range(int(N)):
    t, x, y = map(int, input().split())
    t0 = t - t0
    if (x - x0 != 0) | (y - y0) != 0:
        x0 = x - x0
        y0 = y - y0
    else:
        flg = False
    if t0 < x0 + y0: flg = False

if flg:
    print('yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
x0 = 0
y0 = 0
t0 = 0
t, x, y = [], [], []
N = input()
flg = True
for i in range(int(N)):
    t, x, y = map(int, input().split())
    t0 = t - t0
    x0 = x - x0
    y0 = y - y0
    if t0 < x0 + y0: flg = False

if flg:
    print('yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
if (abs(lst[0][1])+abs(lst[0][2]))%2==lst[0][0]%2:
  if abs(lst[0][1])+abs(lst[0][2])<=lst[0][0]:
    pass
  else:
    print('No')
    sys.exit()
else:
  print('No')

for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])+abs(lst[j][2]-lst[j+1][2])%2==(lst[j+1][0]-lst[j][0])%2:
    if abs(lst[j][1]-lst[j+1][1])+abs(lst[j][2]-lst[j+1][2])<=(lst[j+1][0]-lst[j][0]):
      pass
    else:
      print('No')
      sys.exit()
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
if abs(lst[0][1])+abs(lst[0][2])%lst[0][0]!=0:
  print('No')
  sys.exit()
for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])+abs(lst[j][2]-lst[j+1][2])%(lst[j+1][0]-lst[j][0])==0:
    pass
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
if abs(lst[0][1])+abs(lst[0][2])!=lst[0][0]:
  print('No')
  sys.exit()
for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])+abs(lst[j][2]-lst[j+1][2])==lst[j+1][0]-lst[j][0]:
    pass
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])+abs(lst[j][2]-lst[j+1][2])==lst[j+1][0]-lst[j][0]:
    pass
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])==1:
    if lst[j][2]==lst[j+1][2]:
      pass
    else:
      print('No')
      sys.exit()
  elif abs(lst[j][2]-lst[j+1][2])==1:
    if lst[j][1]==lst[j+1][1]:
      pass
    else:
      print('No')
      sys.exit()    
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])==1:
    if lst[j][2]==lst[j+1][2]:
      pass
    else:
      print('No')
      sys.exit()
  if abs(lst[j][2]-lst[j+1][2])==1:
    if lst[j][1]==lst[j+1][1]:
      pass
    else:
      print('No')
      sys.exit()    
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [0]
X = [0]
Y = [0]
f = True

for i in range(N-1):
  t,x,y = list(map(int,input().split()))
  T.append(t)
  X.append(x)
  Y.append(y)
  if T[-2]-T[-1]<abs(X[-2]-X[-1])+abs(Y[-2]-Y[-1]):
    f = False

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

Submission status: Wrong Answer

Solution code:
n=int(input())
t=0
x=0
y=0
for i in range(n):
  g,h,j=map(int,input().split())
  if (g-t)%2==(abs(h-x)+abs(j-y))%2 and (abs(h-x)+abs(j-y))<=(g-t):
    t=g
    x=h
    j=y
  else:
    print("No")
    exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=0
x=0
y=0
for i in range(n):
  g,h,j=map(int,input().split())
  if (g-t)%2==(abs(h-x)+abs(j-y))%2:
    t=g
    x=h
    j=y
  else:
    print("No")
    exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
 
travel = []
for i in range(n):
    t,x,y = map(int, input().split())
    tmp = [t,x,y]
    travel.append(tmp)
 
now = [0, 0]
time = 0
for tra in travel:
    time,x,y = tra[0]-time,tra[1],tra[2]
    for _ in range(time):
        if now[0] < x:
            now[0] += 1
        elif x < now[0]:
            now[0] -= 1
        elif now[1] < y:
            now[1] += 1
        elif y < now[1]:
            now[1] -= 1
        else:
            now[1] -= 1
    
    if now[0] == x and now[1] == y:
        pass
    else:
        print('No')
        exit()
 
print('Yes')

Submission status: Wrong Answer

Solution code:
# coding: utf-8

n = int(input().rstrip())
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: Wrong Answer

Solution code:
# coding: utf-8

n = int(input().rstrip())


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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
for i in range(N):
    t,x,y=map(int,input().split())
    if (x+y)%2==t%2 and x+y<=t:
        pass
    else:
        print('NO')
        sys.exit()
print('YES')

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
for i in range(N):
    x,y,t=map(int,input().split())
    if (x+y)%2==t%2 and x+y<=t:
        pass
    else:
        print('NO')
        sys.exit()
print('YES')

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
for i in range(N):
    x,y,t=map(int,input().split())
    if x+y<=t and (x+y)%2==t%2:
        pass
    else:
        print("NO")
        sys.exit()
print("YES")

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
for i in range (N):
    x,y,t=map(int,input().split())
    if x+y<=t and (x+y)%2==t%2:
        pass
    else:
        print("NO")
        sys.exit()
print("YES")

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
for i in range (N):
    x,y,t=map(int,input().split())
    if x+y<=t and (x+y)%2==t%2:
        pass
    else:
        print("NO")
    sys.exit()
print("YES")

Submission status: Wrong Answer

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==1:
      print("NO")
      exit()
print("YES")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = 0
for i in range(N):
  a = list(map(int, input().split()))
  print(a[0])
  if a[0] < sum(a) - a[0]:
    print("No")
    exit()
  if (sum(a) - a[0] - a[0])%2 != 0:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
prv = [0,0,0]
for _ in range(N):
  t, x, y = map(int,input().split())
  if abs(prv[0]-x) + abs(prv[1]-y) > t- prv[2] or ((t-prv[2])%2==1 and prv[0]==x and prv[1]==y):
    print('No')
    exit()
  else:
    prv = [x,y,t]
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
pos = [0,0]
for _ in range(N):
  t, x, y = map(int,input().split())
  if abs(pos[0]-x) + abs(pos[1]-y) > t or (pos[0]==x and pos[1]==y):
    print('No')
    exit()
  else:
    pos = [x,y]
print('Yes')

Submission status: Wrong Answer

Solution code:
def canMove(l1: list, l2: list):
    dt = l2[0] - l1[0]
    dr = abs(l1[1] - l2[1]) + abs(l1[2] - l2[2])

    if dr <= dt:
        if dr % 2 != dt % 2:
            print("No")
            exit()
        else:
            return

    else:
        print("No")
        exit()


n = int(input())
travel = [list(map(int, input().split(" "))) for i in range(n)]
travel.insert(0, [1, 1, 1])

for i in range(n + 1):
    canMove(travel[i], travel[i + 1])

print("Yes")

Submission status: Wrong Answer

Solution code:
def canMove(l1: list, l2: list):
    dt = l2[0] - l1[0]
    dr = abs(l1[1] - l2[1]) + abs(l1[2] - l2[2])

    if dr <= dt:
        if dr % 2 != dt % 2:
            print("No")
            exit()
        else:
            return

    else:
        print("No")
        exit()


n = int(input())
travel = [list(map(int, input().split(" "))) for i in range(n)]
travel.insert(0, [1, 1, 1])

for i in range(n):
    canMove(travel[i], travel[i + 1])

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
p = [0,0]
judge=0
for _ in (range(n)):
  num, X, Y = map(int, input().split())
  d = [X, Y]
  dn = abs(p[0]-d[0]+p[1]-d[1])
  if dn%2==0 and dn//2 <= num:
    judge += 1
  else:
    pass
  p[0] = X
  p[1] = Y
if judge == 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
p = [0,0]
judge=0
for _ in (range(n)):
  num, X, Y = map(int, input().split())
  d = [X, Y]
  dn = abs(p[0]-d[0]+p[1]-d[1])
  if dn%2==0 and dn//2 <= num:
    judge += 1
  else:
    pass
  p[0:1] = [X, Y]
if judge == 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
p = [0,0]
judge=0
for _ in (range(n)):
  num, X, Y = map(int, input().split())
  d = [X, Y]
  dn = abs(p[0]-d[0]+p[1]-d[1])
  if dn%2==0 and dn//2 <= num:
    judge += 1
  else:
    pass
if judge == 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

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

now = [0, 0]
flag = 0
time = 0
for tra in travel:
    time,x,y = tra[0]-time,tra[1],tra[2]
    for i in range(time):
        if now[0] < x:
            now[0] += 1
        elif x < now[0]:
            now[0] -= 1
        elif now[1] < y:
            now[1] += 1
        elif y < now[1]:
            now[1] -= 1
        else:
            now[1] -= 1
    
    if now[0] == x and now[1] == y:
        pass
    else:
        print('No')
        sys.exit(0)

print('Yes')

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

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

now = [0, 0]
flag = 0
time = 0
for tra in travel:
    time,x,y = tra[0]-time,tra[1],tra[2]
    for i in range(time):
        if now[0] < x:
            now[0] += 1
        elif x < now[0]:
            now[0] -= 1
        elif now[1] < y:
            now[1] += 1
        elif y < now[1]:
            now[1] -= 1
        else:
            now[1] -= 1
    
    if now[0] == x and now[1] == y:
        pass
    else:
        print('NO')
        sys.exit(0)

print('YES')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
T,X,Y=[],[],[]
for i in range(N):
  TT,XX,YY=map(int,input().split())
  T.append(TT)
  X.append(XX)
  Y.append(YY)
ans=1
if(X[0]+Y[0]>T[0] or (T[0]-X[0]+Y[0])%2):
  ans=0
for i in range(N-1):
  Z=abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i])
  if(Z>T[i] or (T[i]-Z)%2):
    ans=0
if(ans):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

count = 0

for i in range(0,N-1):
	if (A[i+1][0] - A[i][0] + A[i+1][1] - A[i][1] + A[i+1][2] - A[i][2])%2==0:
		count += 1

if count == N:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
# 整数 (縦 H 横 W の行列)
l=[list(map(int, input().split())) for i in range(n)]
l=[[0,0,0]]+l
#print(l)
for i in range(n):
    if abs(l[i+1][1]-l[i][1])+abs(l[i+1][2]-l[i][2])>l[i+1][0]-l[i][0]:
        print('No')
        break
    elif l[i+1][2]+l[i+1][1]-l[i][1]-l[i][2]==0:
        if (l[i+1][0]-l[i][0])%2!=0:
            print('No')
            break
    elif (l[i+1][0]-l[i][0])%abs((l[i+1][2]+l[i+1][1]-l[i][1]-l[i][2]))!=0:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
# 整数 (縦 H 横 W の行列)
l=[list(map(int, input().split())) for i in range(n)]
l=[[0,0,0]]+l
#print(l)
for i in range(n):
    if l[i+1][2]+l[i+1][1]-l[i][1]-l[i][2]==0:
        if (l[i+1][0]-l[i][0])%2!=0:
            print('No')
            break
    elif (l[i+1][0]-l[i][0])%abs((l[i+1][2]+l[i+1][1]-l[i][1]-l[i][2]))!=0:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
# 整数 (縦 H 横 W の行列)
l=[list(map(int, input().split())) for i in range(n)]
l=[[0,0,0]]+l
#print(l)
a=0
for i in range(n):
    if l[i+1][2]+l[i+1][1]-l[i][1]-l[i][2]==0:
        print('No')
        break
    elif (l[i+1][0]-l[i][0])%abs((l[i+1][2]+l[i+1][1]-l[i][1]-l[i][2]))!=0:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
# 整数 (縦 H 横 W の行列)
l=[list(map(int, input().split())) for i in range(n)]
l=[[0,0,0]]+l
#print(l)
a=0
for i in range(n):
    if (l[i+1][0]-l[i][0])%abs((l[i+1][2]+l[i+1][1]-l[i][1]-l[i][2]))!=0:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
# N
# t1 x1 y1
# t2 x2 y2
# ...
# t(n) x(n) y(n)

# (|x(n) - x(n-1)| + |y(n) - y(n -1 )|) % 2 == 奇数・偶数判定
# 2
# 3 1 2
# 6 1 1

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

def judge_travel_interval(t):
    return abs(travel_list[t + 1][1] - travel_list[t][1]) + abs(travel_list[t + 1][2] - travel_list[t][2]) <= travel_list[t + 1][0] - travel_list[t][0]
def judge_odd_even(t):
    return (abs(travel_list[t + 1][1] - travel_list[t][1]) + abs(travel_list[t + 1][2] - travel_list[t][2])) % 2 == (travel_list[t + 1][0] - travel_list[t][0]) % 2


judge = False
for i in range(len(travel_list) - 1):
    if judge_travel_interval(i) == True and judge_odd_even(i) == True:
        judge = True
        continue
    else:
        judge = False
        break
if judge == True:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
# N
# t1 x1 y1
# t2 x2 y2
# ...
# t(n) x(n) y(n)

# (|x(n) - x(n-1)| + |y(n) - y(n -1 )|) % 2 == 奇数・偶数判定
# 2
# 3 1 2
# 6 1 1

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

def judge_travel_interval(t):
    if t == 0:
        return (abs(travel_list[t][1]) + abs(travel_list[t][2])) <= travel_list[t][0]
    else:
        return abs(travel_list[t][1] - travel_list[t - 1][1]) + abs(travel_list[t][2] - travel_list[t - 1][2]) <= travel_list[t][0] - travel_list[t - 1][0]
def judge_odd_even(t):
    return (abs(travel_list[t][1]) + abs(travel_list[t][2])) % 2 == travel_list[t][0] % 2


judge = False
for i in range(len(travel_list)):
    if judge_travel_interval(i) == True and judge_odd_even(i) == True:
        judge = True
        continue
    else:
        judge = False
        break
if judge == True:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
N=int(input())
t1,x1,y1=[0,0,0]
for i in range(N-1):
  t2,x2,y2=[int(s) for s in input().split()]
  if t2-t1<abs(x2-x1)+abs(y2-y1) or (t2-t1)%2!=(x2+y2-x1-y1)%2:
    print("No")
    break
  else:
    t1,x1,y1==[t2,x2,y2]
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
t0,x0,y0=0,0,0
ans=True
for i in range(n):
    t,x,y = map(int, input().split())
    if (abs(x-x0)+ abs(y-y0)-(t-t0)) %2 !=0 and abs(x-x0)+ abs(y-y0)>(t-t0):
        ans=False
    else:
        t0,x0,y0=t,x,y
if ans:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
t0,x0,y0=0,0,0
ans=True
for i in range(n):
    t,x,y = map(int, input().split())
    if (abs(x-x0)+ abs(y-y0)-(t-t0)) %2 !=0:
        ans=False
    else:
        t0,x0,y0=t,x,y
if ans:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
T = 0
X, Y = 0, 0
for i in range(N):
  t, x, y = map(int, input().split())
  d = abs(X-x) + abs(Y-y)
  if t-T < d or d - (t-T) % 2 == 1:
    print ("No")
    break
  else:
    X, Y = x, y
    T = t    
else:
  print ("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
T = 0
X, Y = 0, 0
for i in range(N):
  t, x, y = map(int, input().split())
  d = abs(X-x) + abs(Y-y)
  if t-T < d or d - (t-T) % 2 == 1:
    print ("No")
    X, Y = x, y
    T = t
    break
else:
  print ("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
ary = [list(map(int,input().split())) for _ in range(n)]
nv = [0,0]
count = 0
for i in range(n):
    a,b = abs(nv[0]-ary[i][1]),abs(nv[1]-ary[i][2])
    c = ary[i][0] - count
    if c < a+b:print("No");exit()
    elif ( c - (a+b))% 2 == 1:print("No");exit()
    nv = [ary[i][1],ary[i][2]]
    count += ary[i][0]
else:print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n=int(input())
TXY=[[0,0,0]]+[list(map(int,input().split())) for _ in range(n)]

for i in range(1,n+1):
  dift=abs(TXY[i][0]-TXY[i-1][0])
  difx=abs(TXY[i][1]-TXY[i-1][1])
  dify=abs(TXY[i][2]-TXY[i-1][2])
  print(dift,difx,dify)
  if (dift-(difx-dify))%2!=0 or dift<(difx+dify):
    print('No')
    exit()
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]=(int(x) for x in input().split())
for i in range(n):
  dt=t[i+1]-t[i]
  ddis=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
  if dt%2 != ddis%2:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

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

noflag = False

for i in range(N):
    #tが偶数
    if txy[i][0] % 2 == 0:
        #座標の和が奇数ならno
         if (txy[i][1] + txy[i][2]) % 2 == 1:
             print("No")
             noflag = True
             break
    else:
        #和が偶数ならno
        if (txy[i][1] + txy[i][2]) % 2 == 0:
            print("No")
            noflag = True
            break

    if (txy[i][1] + txy[i][2]) > txy[i][0]:
        print("No")
        noflag = True

if noflag == False:
    print("Yes")

Submission status: Wrong Answer

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 

    print(dist,dtime)

    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: Wrong Answer

Solution code:
N=int(input())

t0=0
x0=0
y0=0
ans=True

for i in range(N):
  #t, x, y = map(int,input().split())
  next=input().split()
  t=int(next[0])
  x=int(next[1])
  y=int(next[2])
  print(x)
  range=abs(x-x0)+abs(y-y0)
  time=t-t0
  
  if t-t0<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
  x0=x
  y0=y

if ans==True:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N=int(input())

t0=0
x0=0
y0=0
ans=True

for i in range(N):
  #t, x, y = map(int,input().split())
  next=input().split()
  t=int(next[0])
  x=int(next[1])
  y=int(next[2])
  range=abs(x-x0)+abs(y-y0)
  time=t-t0
  
  if range>time:
    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
  x0=x
  y0=y

if ans==True:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N=int(input())

t0=0
x0=0
y0=0
ans=True

for i in range(N):
  t, x, y = map(int,input().split())
  print(type(t))
  range=abs(x-x0)+abs(y-y0)
  time=t-t0
  
  if range>time:
    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
  x0=x
  y0=y

if ans==True:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N=int(input())

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

if ans==True:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N=int(input())

t0=0
x0=0
y0=0
for i in range(N):
  t, x, y = map(int,input().split())
  if (t-t0)%2==0 and abs(x-x0)+abs(y-y0)<=(t-t0) and abs(x-x0)+abs(y-y0)%2==0:
    flag=1
  elif (t-t0)%2==1 and abs(x-x0)+abs(y-y0)<=(t-t0) and abs(x-x0)+abs(y-y0)%2==1:
    flag=1
  else:
    flag=0
    break
  t0=t
  x0=x
  y0=y
if flag==1:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

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

for p in range(1,n):
    o = int(t[i])-int(t[i-1])
    p = int(x[i])-int(x[i-1])
    q = int(y[i])-int(y[i-1])
    if (o >= p+q) and ((o - (p+q))%2 == 0):
        b += 1
    else:
        b = b

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

Submission status: Wrong Answer

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


for p in range(1,n+1):
    o = int(t[i])-int(t[i-1])
    p = int(x[i])-int(x[i-1])
    q = int(y[i])-int(y[i-1])
    if o >= p+q and (o - (p+q))%2 == 0:
        b += 1

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

Submission status: Wrong Answer

Solution code:
N=int(input())

t0=0
x0=0
y0=0
flag=0
for i in range(N):
  t, x, y = list(map(int,input().split()))
  if (t-t0)%2==0:
    if (abs((x-x0))+abs((y-y0))<=(t-t0) and ((x-x0)+(y-y0))%2==0)==False:
      flag=1
  else:
    if (abs((x-x0))+abs((y-y0))<=(t-t0) and ((x-x0)+(y-y0))%2==1)==False:
      flag=1

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