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:
for _ in range(int(input())):
  t, x, y = map(int,input().split())
  if (t+x+y)%2 + (t<x+y):
    s = 0
    break
  s = 1
print("YNeos"[s::2])

Submission status: Wrong Answer

Solution code:
N = int(input())
for i in range(N):
  t, x, y = map(int, input().split())
# x+y > t　No
# x+y とtの偶奇が違うならNo
# ここを思いつけば勝ち！
  if ((x+y) > t) or ((x+y +t)%2):
    print("No") 
    exit()
  print("Yes")

Submission status: Wrong Answer

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

now = [0, 0]
for p in txy:
    d = abs(p[1] - now[0] + p[2] - now[1])
    if p[0] % 2 == d % 2:
        continue
    else:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

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

now = [0, 0]
for p in txy:
    d = p[1] - now[0] + p[2] - now[1]
    if p[0] % 2 == d % 2:
        continue
    else:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
t=0
x=0
y=0
ans ="Yes"
for i in range(n):
  tt,xx,yy = map(int,input().split())
  dif = abs(x-xx)
  dif +=abs(y-yy)
  if dif>(tt-t) or dif ==(tt-t+1)%2:
    ans = "No"
    break;
  t=tt
  x=xx
  y=yy
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
t=0
x=0
y=0
ans ="Yes"
for i in range(n):
  tt,xx,yy = map(int,input().split())
  dif = abs(x-xx)
  dif +=abs(y-yy)
  if dif>(tt-t) :
    ans = "No"
    break;
  t=tt
  x=xx
  y=yy
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
t=0
x=0
y=0
ans ="Yes"
for i in range(n):
  tt,xx,yy = map(int,input().split())
  dif = abs(x-xx)
  dif +=abs(y-yy)
  if (tt-t)%2>dif or dif>(tt-t) :
    ans = "No"
    break;
  t=tt
  x=xx
  y=yy
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
t=0
x=0
y=0
ans ="Yes"
for i in range(n):
  tt,xx,yy = map(int,input().split())
  dif = abs(x-xx)
  dif +=abs(y-yy)
  if (tt-t != dif):
    ans = "No"
    break;
  t=tt
  x=xx
  y=yy
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

data = [input() for _ in range(n)]

now = [0,0]

for d in data:
  t, x_now, y_now = [int(i) for i in d.split()]
  x = x_now - now[0]
  y = y_now - now[1]
  s = t - x
  
  if s < 0 or s < y:
    print('No')
    exit()
  elif s == y:
    break
  else:
    for c in range(1, s+1):
      if y == 2*c -s:
        break
    else:
      print('No')
      exit()
  now = [x_now, y_now]
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

data = [input() for _ in range(n)]

for d in data:
  t, x, y = [int(i) for i in d.split()]
  
  s = t - x
  
  if s < 0 or s < y:
    print('No')
    exit()
  elif s == y:
    break
  else:
    for c in range(1, s+1):
      if y == 2*c -s:
        break
    else:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

data = [input() for _ in range(n)]

for d in data:
  t, x, y = [int(i) for i in d.split()]
  
  s = t - x
  
  if s < 0:
    print('No')
    exit()
  elif s == y:
    break
  else:
#    flag = False
    for c in range(0, s+1):
      
      if y == 2*c -s:
        break
    else:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

data = [input() for _ in range(n)]

for d in data:
  t, x, y = [int(i) for i in d.split()]
  
  s = t - x
  
  if s < 0:
    print('No')
    exit()
  elif s == y:
    break
  else:
#    flag = False
    for c in range(1, s+1):
      
      if y == 2*c -s:
        break
    else:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

data = [input() for _ in range(n)]

for d in data:
  t, x, y = [int(i) for i in d.split()]
  
  s = t - x
  
  if s < 0:
    print('No')
    exit()
  if s == y:
    break
  else:
#    flag = False
    for c in range(1, s+1):
      
      if y == 2*c -s:
        break
    else:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
xyt=[list(map(int,input().split())) for _ in range(n)]
if abs(xyt[0][0])+abs(xyt[0][1])>abs(xyt[0][2]) or (xyt[0][0]+xyt[0][1]-xyt[0][2])%2!=0:
  print('No')
  exit()
for i in range(1,n):
  dx,dy,dt=xyt[i][0]-xyt[i-1][0],xyt[i][1]-xyt[i-1][1],xyt[i][2]-xyt[i-1][2]
  if abs(dx)+abs(dy)>abs(dt) or (dx+dy-dt)%2!=0:
    print('No')
    exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
xyt=[list(map(int,input().split())) for _ in range(n)]
for i in range(1,n):
  dx,dy,dt=xyt[i][0]-xyt[i-1][0],xyt[i][1]-xyt[i-1][1],xyt[i][2]-xyt[i-1][2]
  if abs(dx)+abs(dy)>abs(dt) or (dx+dy-dt)%2!=0:
    print('No')
    exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
xyt=[list(map(int,input().split())) for _ in range(n)]
for i in range(1,n):
  dx,dy,dt=xyt[i][0]-xyt[i-1][0],xyt[i][1]-xyt[i-1][1],xyt[i][2]-xyt[i-1][2]
  if (dx+dy-dt)%2!=0:
    print('No')
    exit()
print('Yes')

Submission status: Wrong Answer

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

def func(N,t):
    if (t[0][0]-(t[0][1]+t[0][2]))%2==1 or t[0][0]-(t[0][1]+t[0][2])<0 : return "No"
    
    for i in range(1,N):
        if ((t[i][0]-t[i-1][0])-((t[i][1]-t[i-1][1])+(t[i][2]-t[i-1][2])))%2==1 and ((t[i][0]-t[i-1][0])-((t[i][1]-t[i-1][1])+(t[i][2]-t[i-1][2])))<0 : return "No"
    
    return "Yes"
    
print(func(N,t))

Submission status: Wrong Answer

Solution code:

N = int(input())

for i in range(N):
    t_i, x_i, y_i = map(int, input().split()) #ここまでOK

for i in range(N):
    x_i = abs(x_i)
    y_i = abs(y_i)
    t_i = abs(t_i)


    if (x_i+y_i)> t_i:
        print("No")
        exit()
    elif (x_i+y_i) %2 != t_i%2 :
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[(0,0,0)]
for i in range(N):
  t,x,y=map(int,input().split())
  S.append((t,x,y))
flag=0
for i in range(N):
  if abs(S[i+1][1]-S[i][1])+abs(S[i+1][2]-S[i][2])>S[i+1][0]-S[i][0]:
    flag=1
    break
  elif (S[i+1][0]-S[i][0])%2==1 and (abs(S[i+1][1]-S[i][1])+abs(S[i+1][2]-S[i][2]))%2==0:
    flag=1
    break
  elif (S[i+1][0]-S[i][0])%2==0 and (abs(S[i+1][1]-S[i][1])+abs(S[i+1][2]-S[i][2]))%2==1:
    flag=1
    break

Submission status: Wrong Answer

Solution code:
N = int(input())
Flag = True
x_bef = 0
y_bef = 0
t_bef = 0
for _ in range(N):
    t_now,x_now,y_now = map(int,input().split())
    t = t_now - t_bef
    x = abs(x_now - x_bef)
    y = abs(y_now - y_bef)
    if t < x + y :
        Flag = False
        break
    elif t % 2 == 1 and (x+y)%2 == 0:
        Flag = False
        break
    elif t % 2 == 0 and (x+y)%2 == 1:
        Flag = Flag
        break
print('Yes' if Flag else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
Flag = True
x_bef = 0
y_bef = 0
t_bef = 0
for _ in range(N):
    t_now,x_now,y_now = map(int,input().split())
    t = t_now - t_bef
    x = x_now - x_bef
    y = y_now - y_bef
    if t < x + y :
        Flag = False
        break
    elif t % 2 == 1 and (x+y)%2 == 0:
        Flag = False
        break
    elif t % 2 == 0 and (x+y)%2 == 1:
        Flag = Flag
        break
print('Yes' if Flag else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
Flag = True
for _ in range(N):
    t,x,y = map(int,input().split())
    if t < x + y :
        Flag = False
        break
    elif t % 2 == 1 and (x+y)%2 == 0:
        Flag = False
        break
    elif t % 2 == 0 and (x+y)%2 == 1:
        Flag = Flag
        break
print('Yes' if Flag else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())

plan = []
for i in range(N):
    plan += [[int(n) for n in input().split(' ')]]

ret = "YES"
t0 , x0, y0 = 0, 0, 0
for t, x, y in  plan:
    dt = t-t0
    dx = abs(x-x0)
    dy = abs(y-y0)
    result = dt - (dx+dy)
    if (result<0) | (result%2!=0):
        ret = "NO"
        break
    t0, x0, y0 = t, x, y
print(ret)

Submission status: Wrong Answer

Solution code:
N = int(input())

plan = []
for i in range(N):
    plan += [[int(n) for n in input().split(' ')]]

ret = "YES"
t0 , x0, y0 = 0, 0, 0
for t, x, y in  plan:
    dt = t-t0
    dx = x-x0
    dy = y-y0

    result = dt - (dx+dy)
    if (result<0) | (result%2!=0):
        ret = "NO"
        break

    t0, x0, y0 = t, x, y

print(ret)

Submission status: Wrong Answer

Solution code:
# 2020/03/14
# AtCoder Beginner Contest 086 - C

# Input
n = int(input())
nx = 0
ny = 0
nt = 0

# Check
ans = "Yes"
for i in range(n):
    t, x, y = map(int,input().split())
    dist = abs(nx - x) + abs(ny - y)
    if dist > (t - nt) or (dist <= (t - nt) and dist % 2 == 0):
        ans = "No"
        break
    nx = x
    ny = y
    nt = t

# Output
print(ans)

Submission status: Wrong Answer

Solution code:
# 2020/03/14
# AtCoder Beginner Contest 086 - C

# Input
n = int(input())
nx = 0
ny = 0

# Check
ans = "Yes"
for i in range(n):
    t, x, y = map(int,input().split())
    dist = abs(nx - x) + abs(ny - y)
    if dist > t or (dist <= t and dist % 2 == 0):
        ans = "No"
        break
    nx = x
    ny = y

# Output
print(ans)

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*(n+1)
    x = [0]*(n+1)
    y = [0]*(n+1)
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(2,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import sys 
def main():
    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())

    for i in range(1,n):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
T,X,Y =0,0,0
count = 0
for i in range(N):
    t,x,y = map(int,input().split())
    if abs(t-T) >= abs((x+y)-(X+Y)): count+=1
T,X,Y=t,x,y        
print('Yes' if count==N else 'No' )

Submission status: Wrong Answer

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

ans = 'No'

for line in lst:
    t, x, y = line
    if t < x + y:
        break
    if t % 2 == 0 and (x + y) % 2 != 0:
        break
    if t % 2 != 0 and (x + y) % 2 == 0:
        break

print(ans)

Submission status: Wrong Answer

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

ans = 'No'

for line in lst:
    t, x, y = line
    if t < x + y:
        break
    if t % 2 == 0 and x + y % 2 != 0:
        break
    if t % 2 != 0 and x + y % 2 == 0:
        break
    
    if t - x - y % 2 == 0:
        ans = 'Yes'

print(ans)

Submission status: Wrong Answer

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

ans = 'No'

for line in lst:
    t, x, y = line
    if t < x + y:
        break
    if t % 2 == 0 and x + y % 2 != 0:
        break
    if t % 2 != 0 and x + y % 2 == 0:
        break

    ans = 'Yes'

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
t, x, y = [0] * n, [0] * n, [0] * n
tbl = [False] * n
for i in range(n):
    t[i], x[i], y[i] = map(int, input().split())
else:
    Z = list(zip(t, x, y))
    for d, i in enumerate(Z):
        if i[0] >= i[1] + i[2] and i[0] % (i[1] + i[2]) == 0:
            tbl[d] = True
print("Yes") if set(tbl) & {True} else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
P = [list(map(int,input().split())) for i in range(N)]
flag = False
for tmp in P:
  t,x,y = tmp
  sum_ = x + y
  if (t % 2 == 0 and sum_ % 2 != 0) or (t % 2 != 0 and sum_ % 2 == 0):
    flag = True
    break
if flag:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
P = [list(map(int,input().split())) for i in range(N)]
for tmp in P:
  t,x,y = tmp
  sum_ = x + y
  if t % 2 == 0 and sum_ % 2 == 0:
    print("Yes")
  elif t % 2 != 0 and sum_ % 2 != 0:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [map(int,input().split()) for i in range(n)]
t,x,y = (0,0,0)
for next_pos in s:
    t_next,x_next,y_next = next_pos
    dist = abs(x_next - x) + abs(y_next - y)
    dt = t_next - t
    if dist > t_next - t:
        print('No')
        break
    elif dt % 2 == dist % 2:
        t,x,y = t_next,x_next,y_next
    else:
        print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [map(int,input().split()) for i in range(n)]
t,x,y = (0,0,0)
for next_pos in s:
    t_next,x_next,y_next = next_pos
    dist = abs(x_next - x) + abs(y_next - y)
    if dist > t_next - t:
        print('No')
        break
    else:
        t,x,y = t_next,x_next,y_next
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N=int(input())
des=[list(map(int,input().split())) for _ in range(N)]
des.insert(0,[0,0,0])
for i in range(N):
    time=des[i+1][0]-des[i][0]
    d_x=abs(des[i+1][1]-des[i][1])
    d_y=abs(des[i+1][2]-des[i][2])
    if (time-(d_x+d_y))%2!=0 and time>=(d_x+d_y):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
flag = False
n = int(input())
t = [[0,0,0]]
for i in range(n):
    t.append( [int(x) for x in input().split()])
 
for i in range(n):
    if (abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2])) /  (t[i+1][0]-t[i][0]) > 1:
            break
    elif (abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2]))   / ( t[i+1][0]-t[i][0])  == 1:
            flag = True
            continue
    else:
            if not (( t[i+1][0]-t[i][0]) - (abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2]))  )  &1:
                flag = True
                continue
            else:
                break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

for i in range(n):
    if ((abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2])) /  t[i+1][0]-t[i][0]) > 1:
            break
    elif (abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2]))   / ( t[i+1][0]-t[i][0])  == 1:
            flag = True
            continue
    else:
            if not (( t[i+1][0]-t[i][0]) - (abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2]))  )  &1:
                flag = True
                continue
            else:
                break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

for i in range(n-1):
    if (t[i+1][1]+t[i+1][2]-t[i][1] -t[i][2] ) / ( t[i+1][0]-t[i][0]) > 1:
            continue
    elif (t[i+1][1]+t[i+1][2]-t[i][1] -t[i][2] ) / ( t[i+1][0]-t[i][0])  == 1:
            flag = True
            continue
    elif (t[i+1][1]+t[i+1][2]-t[i][1] -t[i][2]) / ( t[i+1][0]-t[i][0])  < 1:
            if not (( t[i+1][0]-t[i][0]) - (t[i+1][1]+t[i+1][2]-t[i][1] -t[i][2] ) )  &1:
                flag = True
            else:
                continue
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
## coding: UTF-8
N = int(input())
a = []

a.append([0,0,0])
for i in range(N):
    a.append([int(x) for x in input().split()])

#print(a)
#[[0, 0, 0], [3, 1, 2], [6, 1, 1]]こんな感じ[t,x,y]

def hantei(l1, l2): #チェックポイント間の最短距離と時間を比較して到達できるか判定する
    if( (abs(l2[1] - l1[1]) + abs(l2[2] - l1[2]))  <= (l2[0] - l1[0])  ): #チェックポイント間の最短距離<=時間　ならOK　だめならNG
        #print(l1)
        #print(l2)
        return 'OK'
    else:
        return 'NG'

def evenoddhantei(l): #偶奇判定。時間と偶奇が一致していないとダメ
    if(l[0] % 2 == (l[1]+l[2]) % 2):
        return 'OK'
    else:
        return 'NG'

#print(hantei(a[0], a[1]))
#print(hantei(a[1], a[2]))
#print(evenoddhantei(a[0]))
#print(evenoddhantei(a[1]))
#print(evenoddhantei(a[2]))

answer = 'YES'
for i in range(N):
    if(  hantei(a[i], a[i+1]) == 'NG'  ):
        answer = 'NO'

for i in range(N+1):
    if(evenoddhantei(a[i]) == 'NG'):
        answer = 'NO'

print(answer)

Submission status: Wrong Answer

Solution code:
#traveling
n=int(input())
flag=True
lists=[(0,0,0)]
for i in range(n):
    a=list(map(int,input().split()))
    lists.append(tuple(a))
for i in range(1,n+1):
    x,y,z=lists[i-1][0],lists[i-1][1],lists[i-1][2]
    a,b,c=lists[i][0],lists[i][1],lists[i][2]
    if abs(b-y)+abs(c-z)<=abs(a-x) and abs(b-y)%2+abs(c-z)%2==abs(a-x)%2:
        pass
    else:
        flag=False
        break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    posi = [0, 0]
    time = 0
    txy = [[int(i) for i in input().split()] for _ in range(N)]
    for t, x, y in txy:
        move = abs(posi[0] - x) + abs(posi[1] - y)
        if (t - time) >= move and (move > 0 and (t - time) % move):
            return print("No")
        time = t
        posi = [x, y]
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        print(t, x, y, tmp)
        if tmp >= 0 and tmp % 2 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 4 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - x - y - pret + prex + prey
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 4 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - x - y - pret + prex + prey
        #print(t, x, y, tmp)
        if tmp % 4 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N=int(input())
pos=[0,0]
now=0
flag=True
for i in range(N):
  t,x,y=map(int,input().split())
  d = abs(x-pos[0])+abs(y-pos[0])
  if d>t-now:
    flag=False
    break
  else:
    if d%2==(t-now)%2:
      now=t
      pos[0],pos[1]=x,y
    else:
      flag=False
      break
if flag:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - x - y - pret + prex + prey
        #print(t, x, y, tmp)
        if tmp == 0 or tmp == 4 or (tmp - 9) % 4 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N=int(input())
pos=[0,0]
now=0
flag=True
for i in range(N):
  t,x,y=map(int,input().split())
  d = abs(x-pos[0])+abs(y-pos[0])
  if d>t:
    flag=False
    break
  else:
    if d%2==0:
      now=t
      pos[0],pos[1]=x,y
    else:
      flag=False
      break
if flag:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
schedule=[list(map(int,input().split())) for _ in range(N)]
#print(schedule)
flag=1
point=[0,0,0]   #[time,x,y]
cur=[0,0,0]
for i in range(N):
    #print(point,schedule[i])
    if schedule[i][0]-point[0]>=abs(point[1]-schedule[i][1])+abs(point[2]-schedule[i][2]):
        if abs(point[1]-schedule[i][1])+abs(point[2]-schedule[i][2])==0:
            flag=0
            break
        else:
            cur=[point[0]+abs(point[1]-schedule[i][1])+abs(point[2]-schedule[i][2]),schedule[i][1],schedule[i][2]]
            point=cur
    else:
        flag=0
        break
if flag==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
s = [[0,0,0]]
for i in range(N):
    s.append(list(map(int,list(input().split()))))
err = 0
for i in range(N):
    dt = s[i+1][0] - s[i][0]
    dist = abs(s[i+1][1] - s[i][1]) + abs(s[i+1][2] - s[i][2])
    if(dt < dist):
        err = 1
    if(dist % 2 != dt % 2):
        err = 1

if(err == 0):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

ans = "Yes"
for _ in range(N):
    t,x,y = map(int,input().split())
    t_need = abs(x - X) + abs(y - Y)
    if t - T < t_need:
        ans = "no"
        break
    if t - T > t_need:
        if ((t - T) - t_need) % 2 == 1:
            ans = "no"
            break
    T,X,Y = t,x,y

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
before=[0,0,0]
for i in range(n):
    after=list(map(int,input().split()))
    dt=after[0]-before[0]
    dx=abs(after[1]-before[1])
    dy=abs(after[2]-before[2])
    if dt<dx+dy:
        print('No')
        exit()
    else:
        if dt%2!=dx%2+dy%2:
          print('No')
          exit()        
    before=after
print('Yes')

Submission status: Wrong Answer

Solution code:
def boolean(a,b):
    if((abs(a[0] - b[0]) -abs(a[1] - b[1]) - abs(a[2] - b[2])) %2 == 0):
        return 0
    else:
        return 1

N = int(input())
txy=[0 for i in range(N+1)]
txy[0]=[0,0,0]
for i in range(N):
    a=list(map(int,input().split()))
    txy[i+1]=a
ans = "Yes"
for i in range(1,N + 1):
    if(boolean(txy[i-1],txy[i])):
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
def boolean(a,b):
    if(abs(a[0] - b[0]) == abs(a[1] - b[1]) + abs(a[2] - b[2])):
        return 0
    else:
        return 1

N = int(input())
txy=[0 for i in range(N+1)]
txy[0]=[0,0,0]
for i in range(N):
    a=list(map(int,input().split()))
    txy[i+1]=a
ans = "Yes"
for i in range(1,N + 1):
    if(boolean(txy[i-1],txy[i])):
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
def check(a,b):
    distance = abs(a[1]-b[1]) + abs(a[2]-b[2])
#     print(distance)
    
    time = abs(b[0]-a[0])
#     print(time)
    
    c = time - distance
    if((c >= 0) and (c%2==0)):
        return 0
    else:
        return 1
    

def main():
    n = int(input())
    plan = [list(map(int, input().split())) for i in range(n)]
    if(check([0,0,0],plan[0])==1):
        print("NO")
        return
    
    flag = 0
    for i in range(n-1):
        flag += check(plan[i],plan[i+1])
        if (flag >0):
            break
    
    if (flag == 0):
        print("YES")
    else:
        print("NO")
main()

Submission status: Wrong Answer

Solution code:
def boolean(a,b):
    if(abs(a[0] - b[0]) == abs(a[1] - b[1]) + abs(a[2] - b[2])):
        return 0
    else:
        return 1

N = int(input())
txy = [input() for i in range(N)]
txy = [list(map(int, txy[i].split())) for i in range(N)]
ans = "Yes"
for i in range(1,N):
    if(boolean(txy[i-1],txy[i])):
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
# tで（x1, y1) -> (x2, y2)が可能かjudge
def judge(t, x1, y1, x2, y2):
    if abs(x2 - x1) + abs(y2 - y1) > t:
        return False
    else:
        x_2 = abs(x2 - x1) % 2
        y_2 = abs(y2 - y1) % 2
        if x_2 + y_2 == t % 2:
            return True
        else:
            return False


n = int(input())
ans = "Yes"
now_x, now_y = 0, 0
t0 = 0
for _ in range(n):
    t, x, y = map(int, input().split())
    if judge(t-t0, now_x, now_y, x, y):
        now_x, now_y = x, y
        t0 = t
    else:
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
loc = [list(map(int, input().split())) for i in range(N)]
t = 0
x = 0
y = 0
def check(X,Y):
    k=0
    global x,y,t
    for i in range(len(loc)):
        d = (loc[i][0] - t) - (abs(loc[i][1] - X) + abs(loc[i][2] - Y))
        if d %2 ==0 and d >= 0: #（x、y)からはじめに行く位置を探す
            t = loc[i][0]
            x = loc[i][1]
            y = loc[i][2]
            loc.remove(loc[i])
            k =1 #フラグ
            break
         
    if k ==0:
        t = -1  #不可能

while(len(loc) !=0 and t!= -1):
    check(x,y)
    

if t == -1:
    print('NO')

elif len(loc) ==0:
    print('YES')
else:
    print('error') #チェック用

#print(loc)

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())
t.insert(0,0)
x.insert(0,0)
y.insert(0,0)
flag=True
for i in range(1,N+1):
    distance=abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    dt=t[i]-t[i-1]
    if distance>dt:
        flag=False
        break
    elif i%2==0:
        if (x[i]+y[i])%2!=0:
            flag=False
    elif i%2==1:
        if (x[i]+y[i])%2!=1:
            flag=False
if flag==True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
lis = [list(map(int,input().split())) for _ in range(n)]
t = 0
x = 0
y = 0
for i in range(n):
    if lis[i][0] % (lis[i][1] + lis[i][2]) == 0 and (lis[i][0] - t >= abs(lis[i][1]-x) + abs(lis[i][2]-y)):
        x = lis[i][1]
        y = lis[i][2]
        t = lis[i][0]
    else:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
lis = [list(map(int,input().split())) for _ in range(n)]
t = 0
x = 0
y = 0
for i in range(n):
    if lis[i][0] % (lis[i][1] + lis[i][2]) == 0 and (lis[i][0] - t >= lis[i][1]-x + lis[i][2]-y):
        x = lis[i][1]
        y = lis[i][2]
        t = lis[i][0]
    else:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())

#[～][0] =>t [1]=>x [2]=>y
l = [list(map(int,input().split())) for i in range(n)]

judge = 'No'

#初期値
l.insert(0,[0,0,0])
for i in range(n):
    #奇数がT偶数がF
    dt = l[i+1][0]-l[i][0]
    n_j = dt%2
    xy = (l[i+1][1]+l[i+1][2])-(l[i][1]+l[i][2])
    print(dt,n_j,xy,xy%2)
    if n_j==xy%2 and dt>=abs(xy):
        judge = 'Yes'
    else:
        judge ='No'
        break

print(judge)

Submission status: Wrong Answer

Solution code:
n = int(input())

#[～][0] =>t [1]=>x [2]=>y
l = [list(map(int,input().split())) for i in range(n)]

judge = 'No'

#初期値
l.insert(0,[0,0,0])
for i in range(n):
    #奇数がT偶数がF
    n_j = (l[i+1][0]-l[i][0])%2==1
    xy = (l[i+1][1]+l[i+1][2])-(l[i][1]+l[i][2])
    if n_j==xy%2 & n_j>=abs(xy):
        judge = 'Yes'
    else:
        judge ='No'
        break

print(judge)

Submission status: Wrong Answer

Solution code:
n = int(input())

#[～][0] =>t [1]=>x [2]=>y
l = [list(map(int,input().split())) for i in range(n)]

judge = "No"

#初期値
l.insert(0,[0,0,0])
for i in range(n):
    #奇数がT偶数がF
    n_j = (l[i+1][0]-l[i][0])%2==1
    xy = (l[i+1][1]+l[i+1][2])-(l[i][1]+l[i][2])
    if n_j==xy%2 & n_j>=xy:
        judge = "Yes"
    else:
        judge ="No"
        break
print(judge)

Submission status: Wrong Answer

Solution code:
n = int(input())

#[～][0] =>t [1]=>x [2]=>y
l = [list(map(int,input().split())) for i in range(n)]

judge = "No"

#初期値
l.insert(0,[0,0,0])
for i in range(n):
    #奇数がT偶数がF
    n_j = (l[i+1][0]-l[i][0])%2==1
    xy = (l[i+1][1]+l[i+1][2])-(l[i][1]+l[i][2])
    if n_j==xy%2 & n_j>=xy:
        judge = "Yes"
    else:
        judge ="No"
        break

Submission status: Wrong Answer

Solution code:
# ABC 086 C - Traveling 
import numpy as np
import sys
N = int(input())
TXY = np.array([list(map(int, input().split())) for __ in range(N)])
T = TXY[:,0]
X = TXY[:,1]
Y = TXY[:,2]
for i in range(N-1):
    if (T[i+1]-T[i]) < (abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i])):
        print("No")
        sys.exit()
    else:
        if (T[i+1]-T[i]%2)!=(abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i])):
            print("No")
            sys.exit()
print("Yes")

# 模範解答
# N = int(input())
# for _ in range(N):
#     t,x,y = map(int, input().split())
#     if x+y>t or (x+y+t)%2:
#         print("No")
#         exit()
# print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

now_x, now_y = 0, 0

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

    if abs(now_x - x) > t or abs(now_y - y) > t:
        print("No")
        exit()

    elif (abs(now_x - x) + abs(now_y - y)) % 2 == 0:
        if t % 2 != 0:
            print("No")
            exit()

    elif (abs(now_x - x) + abs(now_y - y)) % 2 != 0:
        if t % 2 == 0:
            print("No")
            exit()

    else:
        now_x = x
        now_y = y

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:
import numpy

N=int(input())
S = numpy.zeros(N*3,dtype=int).reshape(N,3)
for i in range(N):
	S[i,:]= list(map(int,input().split()))

t=0
x=0
y=0
i=0
while i <N:
	L=(S[i,0]-t) - abs(S[i,1]-x) - abs(S[i,2]-y)
	if L<0:
		break
	elif L%2==0:
		t=S[i,0]
		x=S[i,1]
		y=S[i,2]
		i+=1
	else:
		break

if i ==N:
	print("YES")
else:
	print("NO")