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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    if (t-(x+y))%2 == 0 or t == x + y:
        print('Yes')
    elif t-(x+y)%2 == 1:
        print('No')
    else:
        print('no')

Submission status: Wrong Answer

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

    if (t-(x+y))%2 == 0 or t == x + y:
        print('Yes')
    elif t-(x+y) == 1:
        print('No')
    else:
        print('no')

Submission status: Wrong Answer

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

    if t-(x+y)%2 == 0 or t == x + y:
        print('Yes')
    elif t-(x+y) == 1:
        print('No')
    else:
        print('no')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
flag=0
for i in range(N):
  t, x, y = list(map(int,input().split()))
  
  if t%2==0:
    if abs(x+y)<=t and (x+y)%2==0:
      continue
    else:
      flag=1
  else:
    if abs(x+y)<=t and (x+y)%2==1:
      continue
    else:
      flag=1

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

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

can = 1

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

print("YES" if can else "NO")

Submission status: Wrong Answer

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

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

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

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

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



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

Submission status: Wrong Answer

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

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

    if (next_time - bef_time) >= range:
        if (next_time - bef_time) % 2 == 0:
            if  range % 2 != 0:
                ans = False
                break
        else:
            if range % 2 == 0:
                ans = False
                break
    else:
        ans = False
        break

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



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

Submission status: Wrong Answer

Solution code:
N = int(input())
TXY = [list(map(int,input().split())) for _ in range(N)]
#print(TXY)
for i in range(N):
  if abs(TXY[i][1]) + abs(TXY[i][2]) > TXY[i][0]:
    print("No")
    exit()
  if TXY[i][0] % 2 != 0:
    if TXY[i][1] % 2 == 0 and TXY[i][2] == 0:
      print("No")
      exit()
    elif TXY[i][1] == 0 and TXY[i][2] % 2 == 0:
      print("No")
      exit()
    elif TXY[i][1] % 2 != 0 and TXY[i][2] % 2 != 0:
      print("No")
      exit()
  else:
    if TXY[i][1] % 2 != 0 and TXY[i][2] == 0:
      print("No")
      exit()
    elif TXY[i][1] == 0 and TXY[i][2] % 2 != 0:
      print("No")
      exit()
    elif TXY[i][1] % 2 == 0 and TXY[i][2] % 2 == 0:
      print("No")
      exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import copy
n = int(input())
x_state = 0
y_state = 0
for i in range(n):
    t, x, y = map(int, input().split())
    if abs(x + y - x_state - y_state) != 1:
        print("No")
        exit()
    x_state = copy.deepcopy(x)
    y_state = copy.deepcopy(y)
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
time_space = [(int(x) for x in input().split()) for i in range(n)]
pos = [0,0]
for t, x, y in time_space:
    if (t - abs(x - pos[0]))%2 != abs(y-pos[1]):
        print('No')
        exit()
    else:
        pos = [x, y]
print('Yes')

Submission status: Wrong Answer

Solution code:
N=int(input())
txy=[[0,0,0]]
for i in range(0,N):
    tmp=input().split()
    tmp=[int(s) for s in tmp]
    txy.append(tmp)
cnt=0
for i in range(0,N):
    d=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    print(d)
    t=txy[i+1][0]-txy[i][0]
    print(t)
    if d <= t and (t-d)%2==0:
        cnt+=1
    else:
        break
if cnt==N:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N=int(input())
txy=[[0,0,0]]
for i in range(0,N):
    tmp=input().split()
    tmp=[int(s) for s in tmp]
    txy.append(tmp)
for i in range(0,N):
    t1=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    t2=txy[i+1][0]-txy[i][0]
    if not(t1 <= t2 and (t2-t1)%2==0):
        print('No')
        break
print('Yes')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

t0=0
x0=0
y0=0

ans="Yes"

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

print(ans)

Submission status: 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())
    d=abs(x-x0)+abs(y-y0)
    if d>t-t0:
        print("No")
        exit()
    else:
        if ((t-t0)-d)%2!=0:
            print("No")
            exit()
    t0=1
    x0=x
    y0=y

print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

Submission status: 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 != 0:
    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 != 2:
    print("NO")
    exit()
print("YES")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

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

print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

pre_sum = 0
pre_t = 0
for i in range(n):
    if abs((x[i] + y[i]) - pre_sum) <= t[i] - pre_t:
        if not (t[i] - pre_t) % 2 == (abs(x[i] + y[i]) - pre_sum) % 2:
            print("No")
            break

    pre_sum = abs(x[i] + y[i])
    pre_t = t[i]
else:
    print("Yes")

Submission status: Wrong Answer

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

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

pre_sum = 0
pre_t = 0
for i in range(n):
    if abs((x[i] + y[i]) - pre_sum) <= t[i] - pre_t:
        if pre_sum % 2 == 0:
            if not (t[i] - pre_t) % 2 == 0 and (x[i] + y[i]) % 2 == 0:
                print("No")
                break
            elif not (t[i] - pre_t) % 2 == 1 and (x[i] + y[i]) % 2 == 1:
                print("No")
                break
        else:
            if not (t[i] - pre_t) % 2 == 1 and (x[i] + y[i]) % 2 == 0:
                print("No")
                break
            elif not (t[i] - pre_t) % 2 == 0 and (x[i] + y[i]) % 2 == 1:
                print("No")
                break
    pre_sum = x[i] + y[i]
    pre_t = t[i]
else:
    print("Yes")

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

pre_sum = 0
pre_t = 0
for i in range(n):
    if (x[i] + y[i]) - pre_sum <= t[i] - pre_t:
        if pre_sum % 2 == 0:
            if not (t[i] - pre_t) % 2 == 0 and (x[i] + y[i]) % 2 == 0:
                print("No")
                break
            elif not (t[i] - pre_t) % 2 == 1 and (x[i] + y[i]) % 2 == 1:
                print("No")
                break
        else:
            if not (t[i] - pre_t) % 2 == 1 and (x[i] + y[i]) % 2 == 0:
                print("No")
                break
            elif not (t[i] - pre_t) % 2 == 0 and (x[i] + y[i]) % 2 == 1:
                print("No")
                break
    pre_sum = x[i] + y[i]
    pre_t = t[i]
else:
    print("Yes")

Submission status: Wrong Answer

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

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

pre_sum = 0
pre_t = 0
for i in range(n):
    if (x[i] + y[i]) - pre_sum <= t[i] - pre_t:
        if pre_sum % 2 == 0:
            if not (t[i] - pre_t) % 2 == 0 and (x[i] + y[i]) % 2 == 0:
                print("No")
                break
        else:
            if not (t[i] - pre_t) % 2 == 1 and (x[i] + y[i]) % 2 == 0:
                print("No")
                break
    pre_sum = x[i] + y[i]
    pre_t = t[i]
else:
    print("Yes")

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    func()

Submission status: Wrong Answer

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


for i in range(len(a)):
  x_goal = a[i][1]
  y_goal = a[i][2]
  if i == 0:
    t = a[i][0]
    if y_goal >= 0:
      while y != y_goal:
        y += 1
        t -= 1
    else:
      while y != y_goal:
        y -= 1
        t -= 1
    for time0 in range(t):
      if x > x_goal:
        x -= 1
      else:
        x += 1
    if x == x_goal:
      continue
    else:
      continue
      
  elif i != 0:
    t = a[i][0]-a[i-1][0]
    t = a[i][0]-a[i-1][0]
  while y != y_goal:
    if y_goal > y:
      y += 1
      t -= 1
    elif y_goal < y:
      y -= 1
      t -= 1
    
    for time1 in range(t):
      if x > x_goal:
        x -= 1
      else:
        x += 1
if x == x_goal:
  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)
t[0] = 0
x[0] = 0
y[0] = 0
result = "YES"

def is_even(num):
    return num % 2 == 0

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

for i in range(1, N+1):
    time = t[i] - t[i-1]
    xlen = abs(x[i] - x[i-1])
    ylen = abs(y[i] - y[i-1])
    distance = xlen+ylen
    if is_even(time) == is_even(distance) and distance <= time:
        continue
    result = "NO"
    break

print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = [list(map(int,list(input().split()))) for i in range(n)]
#print(li)
if li[0][0] == li[0][1] + li[0][2]:
    flag = True
else:
    flag  = False
for i in range(len(li)-1):
    if (li[i+1][0] - li[i][0]) - (li[i+1][1] - li[i][1]) + (li[i+1][2] - li[i][2]) == 0 or ((li[i+1][0] - li[i][0]) - (li[i+1][1] - li[i][1]) + (li[i+1][2] - li[i][2]))%2 == 0:
        flag = True
    else:
        flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=0
for i in range(N):
    t,x,y = map(int,input().split())
    if x+y<=t and t%2==(x+y)%2:
        print('No')
        exit() 
print('Yes')

Submission status: Wrong Answer

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

tn, xn, yn = 0, 0, 0

for i in list_plan:
    tn, xn, yn = int(i[0]) - t, int(i[1]) - x, int(i[2]) - y
    if xn + yn < tn and (tn - xn - yn)%2 == 0:
        t, x, y = i[0], i[1], i[2]
    else:
        print("No")
        exit()
        
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

t, x, y = [0]*(N+1), [0]*(N+1), [0]*(N+1)
t[0] = x[0] = y[0] = 0
result = "YES"

def is_even(num):
    return num % 2 == 0

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

for i in range(1, N+1):
    time = t[i] - t[i-1]
    xlen = x[i] - x[i-1]
    ylen = y[i] - y[i-1]
    distance = abs(xlen)+abs(ylen)
    if is_even(time) == is_even(distance) and distance <= time:
        continue
    result = "NO"
    break

print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())

t, x, y = [0]*(N+1), [0]*(N+1), [0]*(N+1)
t[0] = x[0] = y[0] = 0
result = "YES"

def is_even(num):
    return num % 2 == 0


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

for i in range(1, N+1):
    time = t[i] - t[i-1]
    xlen = x[i] - x[i-1]
    ylen = y[i] - y[i-1]
    if is_even(time) == is_even(xlen+ylen) and abs(xlen) <= time and abs(ylen) <= time - abs(xlen):
        continue
    result = "NO"
    break

print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())

t, x, y = [0]*(N+1), [0]*(N+1), [0]*(N+1)
t[0] = x[0] = y[0] = 0
result = "YES"

def is_even(num):
    return num % 2 == 0


for i in range(1, N+1):
    t[i], x[i], y[i] = list(map(int, input().split()))
    time = t[i] - t[i-1]
    xlen = x[i] - x[i-1]
    ylen = y[i] - y[i-1]
    if is_even(time) == is_even(xlen+ylen) and abs(xlen) <= time and abs(ylen) <= time - abs(xlen):
        continue
    result = "NO"
    break

print(result)

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

for i in range(n):
	t,x,y = map(int, sys.stdin.readline().split())
	d = abs(x)+abs(y)

	if d < t and (d - t) % 2 == 0:
		print('Yes')
		exit()
print('No')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

for i in range(n):
	t,x,y = map(int, sys.stdin.readline().split())
	d = abs(x)+abs(y)

	if d < t and (d - t) % 2 == 0:
		print('No')
		exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())


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

	if d > t or (d - t) % 2 != 0:
		print('No')

print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

X = 0
Y = 0
T = 0

for i in range(n):
	t,x,y = map(int, input().split())
	d = abs(X-x)+abs(Y-y)

	if d > t-T or (d - (t-T)) % 2 != 0:
				print('No')
	else:
		X = x
		Y = y
		T = t

print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

X = 0
Y = 0
T = 0

for i in range(n):
	t,x,y = map(int, input().split())
	d = abs(X-x)+abs(Y-y)

	if ((d)>(t-T)) or ((d - (T-t)) % 2 != 0):
				print('No')
	else:
		X = x
		Y = y
		T = t

print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

X = 0
Y = 0
T = 0

for i in range(n):
	t,x,y = map(int, sys.stdin.readline().split())
	d = abs(X-x)+abs(Y-y)

	if ((d)>(T-t)) or ((d - (T-t)) % 2 != 0):
				print('No')
	else:
		X = x
		Y = y
		T = t

print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

X = 0
Y = 0
T = 0

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

	d = abs(X-x)+abs(Y-y)
	if ((d)<(T-t)) and ((d - (T-t)) % 2 == 0):
		X = x
		Y = y
		T = t
	else:
		print('No')

print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

X = 0
Y = 0
T = 0

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

	sum = abs(X-x)+abs(Y-y)
	if ((sum)<(T-t)) and (sum%2 == (T-t)%2):
		X = x
		Y = y
		T = t
	else:
		print('No')

print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

X = 0
Y = 0
T = 0

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

	sum = abs(X-x)+abs(Y-y)
	if (sum)<(T-t) and sum%2 == (T-t)%2:
		X = x
		Y = y
		T = t
	else:
		print('No')

print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

X = 0
Y = 0
T = 0

for i in range(1, n):
	t,x,y = map(int, sys.stdin.readline().split())

	sum = abs(X-x)+abs(Y-y)
	if (sum)<(T-t) and sum%2 == (T-t)%2:
		X = x
		Y = y
		T = t
	else:
		print('No')

print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(input())

X = 0
Y = 0
T = 0

for i in range(1, n):
	t,x,y = map(int, sys.stdin.readline().split())

	sum = abs(X-x)+abs(Y-y)
	if ( sum )<T-t and sum%2 == (T-t)%2:
		X = x
		Y = y
	else:
		print('No')

print('Yes')

Submission status: Wrong Answer

Solution code:
import math

n = int(input())

X = 0
Y = 0
T = 0

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

	sum = abs(X-x)+abs(Y-y)
	if ( sum )<T-t and sum%2 == T-t:
		X = x
		Y = y
	else:
		print('No')

print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
list_plan = []
for i in range(n):
    list_plan.append(input().split())
    
t, x, y = 0, 0, 0
for i in list_plan:
    tn, xn, yn = int(i[0]) - t, int(i[1]) - x, int(i[2]) - y
    if xn + yn < tn and (tn - xn - yn)%2 == 0:
        t, x, y = i[0], i[1], i[2]
    else:
        print("No")
        exit()
        
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
list_plan = []
for i in range(n):
    list_plan.append(input().split())
    
for i in list_plan:
    if i[1] + i[2] < i[0] and (int(i[0]) - int(i[1]) - int(i[2]))%2 == 0:
        pass
    else:
        print("No")
        exit()
        
print("Yes")

Submission status: Wrong Answer

Solution code:
class AtCoDeer:
    def __init__(self):
        self.pos = {"x": 0, "y": 0}
        self.time = 0

    def move(self, to_x, to_y):
        self.pos = {"x": to_x, "y": to_y}
        return self.pos

    def can_move(self, t, to_x, to_y):
        dx = abs(to_x-self.pos.get("x"))
        dy = abs(to_y-self.pos.get("y"))
        total_move = dx + dy
        dt = t - self.time

        if dt < total_move:
            return False
        elif (dt-total_move) % 2 != 0:
            return False
        else:
            self.move(to_x, to_y)
            self.time = t
            return True


def main():
    n = int(input()) - 1
    at_co_deer = AtCoDeer()

    while(at_co_deer.can_move(*[int(x) for x in input().split()])):
        if n <= 0:
            break
        elif n > 0:
            n -= 1
    
    # 計画破綻判明後のデータ読み捨て
    for i in range(n):
        input()

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
All = [list(map(int, input().split())) for _ in range(N)]
pre_x = 0
pre_y = 0
pre_t = 0

can = True
for n in range(N):
    can2 = False
    T = All[n][0] - pre_t
    d = abs(All[n][1] - pre_x) + abs(All[n][2] - pre_y)
    print(T, d)
    if d <= T and T % 2 ==  d % 2:
        can2 = True

    if can2 == False:
        can = False
        break

    pre_t = All[n][0]
    pre_x = All[n][1]
    pre_y = All[n][2]

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

Submission status: Wrong Answer

Solution code:
N = int(input())
All = [list(map(int, input().split())) for _ in range(N)]
pre_x = 0
pre_y = 0
pre_t = 0

can = True
for n in range(N):
    can2 = False
    T = All[n][0] - pre_t
    d = abs(All[n][1] - All[n][2])
    if d <= T and T % 2 ==  d % 2:
        can2 = True

    if can2 == False:
        can = False
        break

    pre_t = All[n][0]
    pre_x = All[n][1]
    pre_y = All[n][2]

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

Submission status: Wrong Answer

Solution code:
N = int(input())
All = [list(map(int, input().split())) for _ in range(N)]
t = [row[0] for row in All]
x = [row[1] for row in All]
y = [row[2] for row in All]
pre_x = 0
pre_y = 0
pre_t = 0

can = True
for n in range(N):
    can2 = False
    T  = abs(t[n] - pre_t)
    dx = abs(x[n] - pre_x)
    dy = abs(y[n] - pre_y)
    print(T,dx,dy)
    if dx + dy == 0 and T % 2 == 0:
        can2 = True
        # print("成功")
    elif dx + dy == 0 and T % 2 != 0:
        can2 = False
        # print("失敗")
        break

    if (T % (dx + dy)) == 0:
        can2 = True
        # print("成功")

    if can2 == False:
        can = False
        # print("失敗")
        break

    pre_t = t[n]
    pre_x = x[n]
    pre_y = y[n]

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

Submission status: Wrong Answer

Solution code:
N = int(input())
All = [list(map(int, input().split())) for _ in range(N)]
t = [row[0] for row in All]
x = [row[1] for row in All]
y = [row[2] for row in All]
pre_x = 0
pre_y = 0
pre_t = 0

can = True
for n in range(N):
    can2 = False
    T  = abs(t[n] - pre_t)
    dx = abs(x[n] - pre_x)
    dy = abs(y[n] - pre_y)
    print(T,dx,dy)
    if dx + dy == 0 and T % 2 == 0:
        can2 = True
        print("成功")
    elif dx + dy == 0 and T % 2 != 0:
        can2 = False
        print("失敗")
        break

    if (T % (dx + dy)) == 0:
        can2 = True
        print("成功")

    if can2 == False:
        can = False
        print("失敗")
        break

    pre_t = t[n]
    pre_x = x[n]
    pre_y = y[n]

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