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

def over():
    print('No')
    exit(0)

for i,j in enumerate(range(N)):
    if i == 0:
        order, temp_x, temp_y = 0, 0, 0
    schedule, x, y = map(int, input().split())
    distance_to_next = abs(x - temp_x) + abs(y - temp_y)
    order = schedule - order
    temp_x, temp_y = x, y
    if order % 2 == 0:
        # even order
        if distance_to_next % 2 == 0 and distance_to_next <= order:
            continue
        else:
            over()
    else:
        # odd order
        if distance_to_next % 2 == 1 and distance_to_next <= order:
            continue
        else:
            over()

print('Yes')

# yup!

Submission status: Wrong Answer

Solution code:
for i in range(int(input())):
 t,x,y=map(int,input().split())
 if i:
  l=abs(x-p)+abs(y-q)
  if(l-t-s)%2or l>t-s:print("No");break
 s,p,q=t,x,y
else:print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())

l = []
for i in range(n):
    l.append(input().split())

judge = 1
e = [int(i) for i in l[0]]
t, x, y = e
for i in range(n):
    d = x + y
    if (t < d):
        judge = 0
        break
    elif (t % 2 != d % 2):
        judge = 0
        break
    if (len(l) < i+1):
        next = l[i+1]
        t = int(next.get(0)) - t
        x = abs(int(next.get(1)) - x)
        y = abs(int(next.get(2)) - y)

if (judge == 1):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = input()

l = []
for i in range(int(n)):
    l.append(input().split())

judge = 1
e = [int(i) for i in l[0]]
t, x, y = e
for i in range(int(n)):
    r = t - x - y
    if (r < 0):
        judge = 0
        break
    elif (r > 0 & (r % 2 != 0)):
        judge = 0
        break
    if (len(l) < i+1):
        next = l[i+1]
        t = int(next.get(0)) - t
        x = abs(int(next.get(1)) - x)
        y = abs(int(next.get(2)) - y)

if (judge == 1):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = input()

l = []
for i in range(int(n)):
    l.append(input().split())

judge = 1
e = [int(i) for i in l[0]]
t, x, y = e
for i in range(int(n)):
    r = t - x - y
    if (r < 0):
        judge = 0
        break
    elif (r > 0 & (r % 2 != 0)):
        judge = 0
        break
    if (len(l) < i+1):
        next = l[i+1]
        t = int(next.get(0)) - t
        x = int(next.get(1)) - x
        y = int(next.get(2)) - y

if (judge == 1):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
PX = [list(map(int,input().split()))]

judge = True
pos = [0,0,0]
for p in PX:
    t = pos[0]
    x = pos[1]
    y = pos[2]
    ti = p[0]
    xi = p[1]
    yi = p[2]
    if abs(x-xi)+abs(y-yi) > (ti-t):
        judge = False
    if (x+y+(ti-t))%2 != (xi+yi)%2:
        judge = False
if judge:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def check():
    N = int(input())
    t1,x1,y1 = [0,0,0]
    
    for _ in range(N):
        t2,x2,y2 = [int(i) for i in input().split(' ')]
        x_sub = abs(x1-x2)
        y_sub = abs(y1-y2)
        t_sub = t2 - t1
        t = t_sub - x_sub - y_sub
        if t < 0:
            return 'no'
        else:
            if t % 2 == 0:
                t1 = t2
                x1 = x2
                y1 = y2
            else:
                return 'no'
    return 'yes'

print(check())

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())

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

t.insert(0, 0)
x.insert(0, 0)
y.insert(0, 0)
for i in range(1, N):
    s = t[i] - t[i - 1]
    k = x[i] - x[i - 1]
    l = y[i] - y[i - 1]
    p = k + l
    if not p % s == 0:
        print('No')
        sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
manhattan_distance = lambda x1, y1, x2, y2 : abs(x1-x2)+abs(y1-y2)

def solve():
    N = int(input())
    t_pre = 0
    x_pre = 0
    y_pre = 0
    for _ in range(N):
        t, x, y = map(int, input().split())
        # print(manhattan_distance(x, y, x_pre, y_pre), t - t_pre)
        if (t - t_pre) % manhattan_distance(x, y, x_pre, y_pre) != 0:
            print('No')
            return
        
    print('Yes')
    
solve()

Submission status: Wrong Answer

Solution code:
N=int(input())
oldn,oldx,oldy=0,0,0
#print(x,y)
no=0
for i in range(N):
  nxy=input().split()
  n,x,y=int(nxy[0]),int(nxy[1]),int(nxy[2])
#  print(n,x,y)
  ndiff = n - oldn
  distance = abs(x - oldx) + abs(y - oldy)
#  print(ndiff,distance)
  oldn,oldx,oldy=n,x,y
  if distance > ndiff:
    print("No")
    no=1
    break
  print((ndiff-distance)%2)
  if (ndiff-distance)%2==0:
    continue
  else:
    no=1
    print("No")
    break
if no==0:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import math
import numpy as np


#横並び
#a, b, c, x = map(int, [input() for i in range(4)])
#z = list(map(int, input().split()))
#n, a, b = map(int, input().split())

#print(len(z))
#for i in z:
#    print(i)

#a = sorted(a,reverse = True)
#print(sum(a[::2]) - sum(a[1::2]))
#z = map(int, [input() for i in range(int(n))])
#data_list = [ list(map(int,input().split(" "))) for i in range(3)]



n = int(input())
ans = 1
ta = 0
xa = 0
ya = 0
for i in range(n):
    t,x,y = map(int, input().split())
    if not (((t-ta) - (x-xa) - (y-ya)) % 2) == 0 and ((t-ta) >= (abs(x-xa) + abs(y - ya))):
        ans = 0;
if ans:
    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 (x+y)>t or (t+x+y)%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 and (t+x+y)%2==0:
    print("yes")
    exit()
  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 (x+y)<=t or (t+x+y)%2==0:
    print("yes")
    exit()
  else:
    print("NO")

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

#初期位置と時間
x0=0
y0=0
t0=0


for i in range(N):
    #現在時刻と次の時間との差
    dt=t[i]-t0
    #現在位置と次の目標地点との距離
    d=abs(x0-x[i])+abs(y0-y[i])
    #距離が時間差よりも大きければ到達できないのでNO
    if dt-d<0:
        print("No")
        exit()
    #距離と時間差の偶奇が不一致なら到達できないのでNo
    if (dt-d)%2>0:
        print("No")
    #初期位置を時刻tiのものに更新
    x0=x[i]
    y0=y[i]
    t0=t[i]

#上の条件をすべてクリアできていればYes
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())#訪問すべき点の数
t=[0]*N
x=[0]*N
y=[0]*N

#各時刻に訪問すべき点の入力
for i in range(N):
    t[i],x[i],y[i]=map(int, input().split())

#初期位置と時間
x0=0
y0=0
t0=0


for i in range(N):
    #現在時刻と次の時間との差
    dt=t[i]-t0
    #現在位置と次の目標地点との距離
    d=abs(x0-x[i])+abs(y0-y[i])
    #距離が時間差よりも大きければ到達できないのでNO
    if dt-d<0:
        print("No")
        exit()
    #距離と時間差の偶奇が不一致なら到達できないのでNo
    if (dt-d)%2>0:
        print("No")
    #初期位置を時刻tiのものに更新
    x0=x[i]
    y0=y[i]
    t0=t[i]

#上の条件をすべてクリアできていればYes
print("Yes")

Submission status: Wrong Answer

Solution code:
#訪問すべき点の数
N=int(input())
t=[0]*N
x=[0]*N
y=[0]*N

#各時刻に訪問すべき点の入力
for i in range(N):
    t[i],x[i],y[i]=map(int, input().split())

#初期位置と時間
x0=0
y0=0
t0=0


for i in range(N):
#現在時刻と次の時間との差
    dt=t[i]-t0
#現在位置と次の目標地点との距離
    d=abs(x0-x[i])+abs(y0-y[i])
#距離が時間差よりも大きければ到達できないのでNO
    if dt-d<0:
        print("No")
        exit()
#距離と時間差の偶奇が不一致なら到達できないのでNo
    if (dt-d)%2>0:
        print("No")
#初期位置を時刻tiのものに更新
    x0=x[i]
    y0=y[i]
    t0=t[i]

#上の条件をすべてクリアできていればYes
print("Yes")

Submission status: Wrong Answer

Solution code:
num = int(input())
if num == 1:
    t = 1
    x = 0
    y = 0
else:
    t,x,y = map(int,input().split())
if num == 1:
    num = num + 1
for _ in range(num - 1):
    t1, x1, y1 = map(int, input().split())
    if abs(t - t1) < abs(x - x1):
        print('No')
    elif abs(t - t1) < abs(y - y1):
        print('No')
    elif abs(t - t1) % 2 == 1:
        if x == x1 and y == y1:
            print('No')
    t = t1
    x = x1
    y = y1
print('Yes')

Submission status: Wrong Answer

Solution code:
num = int( input())
check = 0
step_b = 0
x_b = 0
y_b = 0
for i in range(num):
    step ,x ,y = map(int,input().split())
    if ((x-x_b)+(y-y_b) - (step-step_b)  > 0) or (((x-x_b)+(y-y_b) - (step - step_b))%2 == 1 ) :
        check = 1
        break
    print(((x-x_b)+(y-y_b) - (step - step_b)))
    x_b = x
    y_b = y
    step_b = step
if check == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

for i in range(n-1):
  t_temp = t[i+1] - t[i]
  x_temp = abs(x[i+1] - x[i])
  y_temp = abs(y[i+1] - y[i])
  d = x_temp + y_temp
  if d in range(t_temp, -1, -2):
    continue
  else:
    ans = 'No'
print(ans)

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



ox = 0 
oy = 0
ot =0

for i in range(N):
    dt=t[i] - ot 

    d = abs(ox - x[i]) + abs(oy - y[i])
    if d > abs(dt):
        print('No')
        exit()

    if d%2 != dt%2:
        print('No')
        exit()

    ox=x[i]
    oy=y[i]
    ot=t[i]

print('OK')

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



ox = 0 
oy = 0
ot =0

for i in range(N):
    dt=t[i] - ot 

    d = abs(x[i] - ox) + abs(y[i] - oy)
    if d > abs(dt):
        print('No')
        exit()

    if d%2!= dt%2:
        print('No')
        exit()

    ox=x[i]
    oy=y[i]
    ot=t[i]

print('OK')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n = int(input())
#n = 2

prev = [0,0,0]
for i in range(n):
    txy = list(map(int, input().split()))
    #txy = list(map(int, ["5 1 1", "100 1 1"][i].split()))
    t = txy[0] - prev[0]
    x = abs(txy[1] - prev[1])
    y = abs(txy[2] - prev[2])
    d = x + y
    if (d - t) % 2 != 0:
        print('No')
        exit()
    prev = txy
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n = int(input())
#n = 2

prev = [0,0,0]
for i in range(n):
    txy = list(map(int, input().split()))
    #txy = list(map(int, ["5 1 1", "100 1 1"][i].split()))
    t = txy[0] - prev[0]
    x = abs(txy[1] - prev[1])
    y = abs(txy[2] - prev[2])
    d = x + y
    if not( (d - t) % 2 == 0):
        print('NO')
        exit()
    prev = txy
print('YES')

Submission status: Wrong Answer

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

for i in range(len(li)):
    if li[i][0] >= li[i][1] + li[i][2] and (li[i][0] - (li[i][1] + li[i][2]))%2 == 0:
        flag = True
    else:
        flag = False
        break
    break
if flag == True:
    print("Yes")
elif flag == False:
    print("No")

Submission status: Wrong Answer

Solution code:
_,*p=map(int,open(0).read().split());print(('Yes','No')[sum(1 for t,x,y in zip(*[iter(p)]*3)if (t<x+y)|t%2!=(x+y)%2)>0])

Submission status: Wrong Answer

Solution code:
_,*p=map(int,open(0).read().split());print(('Yes','No')[sum(1 for t,x,y in zip(*[iter(p)]*3)if t<x+y|t%2!=(x+y)%2)>0])

Submission status: Wrong Answer

Solution code:

#入力受け取り
n = int(input())
tourList = []
for i in range(n):
    array = list(map(int, input().strip().split()))
    tourList.append(array)

#DebugPrint
currentTime = 0
currentX = 0
currentY = 0

for i in range(len(tourList)) :
    Time = tourList[i][0]
    X = tourList[i][1]
    Y = tourList[i][2]

    Time = Time - currentTime
    X = X - currentX
    Y = Y - currentY
    flag=False
    Z=0 #往復調整用
    NUM = abs(X)+abs(Y)
    if( (Time-NUM)%2==0 ):
        flag=True

    # while (X+Y+Z) <= Time :
    #     if X+Y+Z == Time:
    #         flag=True
    #         break
    #     else:
    #         Z+=2
    
    #継続判定
    if flag == False:
        print("No")
        exit()
    
    currentTime = Time
    currentX = X
    currentY = Y

print("Yes")

    #最初の点がまず実現可能か

Submission status: Wrong Answer

Solution code:

#入力受け取り
n = int(input())
tourList = []
for i in range(n):
    array = list(map(int, input().strip().split()))
    tourList.append(array)

#DebugPrint
currentTime = 0
currentX = 0
currentY = 0

for i in range(len(tourList)) :
    Time = tourList[i][0]
    X = tourList[i][1]
    Y = tourList[i][2]

    Time = Time - currentTime
    X = X - currentX
    Y = Y - currentY
    flag=False
    Z=0 #往復調整用

    if( (Time-(X+Y))%2==0 ):
        flag=True
        
    # while (X+Y+Z) <= Time :
    #     if X+Y+Z == Time:
    #         flag=True
    #         break
    #     else:
    #         Z+=2
    
    #継続判定
    if flag == False:
        print("No")
        exit()
    
    currentTime = Time
    currentX = X
    currentY = Y

print("Yes")

    #最初の点がまず実現可能か

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []

for i in range(n):
    a.append(list(map(int, input().split())))

for i in a:
    if i[0] < i[1] + i[2] or sum(i) % 2:
        print("NO")
        exit()

print("YES")

Submission status: Wrong Answer

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

for j in range(1, N + 1):
    dt = txy[j][0] - txy[j - 1][0]
    dx = txy[j][1] - txy[j - 1][1]
    dy = txy[j][2] - txy[j - 1][2]
    d = dt - abs(dx) - abs(dy)

    if d < 0 or d % 2 != 0:
        print("NO")
        flg = 1
        break

if flg == 0:
    print("YES")

Submission status: Wrong Answer

Solution code:
n=int(input())

li=[list(map(int,input().split())) for i in range(n)]
li.insert(0,[0,0,0])
print(li)

for i in range(n) :
  cr=li[i]
  nx=li[i+1]
  dist=abs(nx[1]-cr[1])+abs(nx[2]-cr[2])
  dt=nx[0]-cr[0]
  if dt<dist :
    print("No")
    exit()
  if (dt%2) != (dist%2) :
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

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

#print(li)

for i in range(n-1) :
  cr=li[i]
  nx=li[i+1]
  dist=abs(nx[1]-cr[1])+abs(nx[2]-cr[2])
  dt=nx[0]-cr[0]
  if dt<dist :
    print("No")
    exit()
  if (dt%2) != (dist%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 i == 0:
        if x + y != t:
            print('No')
            exit()
        else:
            bx = x
            by = y
            bt = t
    else:
        d = abs(x - bx) + abs(y - by)
        dt = t - bt
        bx = x
        by = y
        bt = t

        # print(d, dt)

        if d % 2 == 1 and dt % 2 == 0 and d <= dt:
            print('No')
            exit()
        elif d % 2 == 0 and dt % 2 == 1 and d <= dt:
            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 i == 0:
        if x + y != t:
            print('No')
            exit()
        else:
            bx = x
            by = y
            bt = t
    else:
        d = abs(x - bx) + abs(y - by)
        dt = t - bt
        bx = x
        by = y
        bt = t

        print(d, dt)

        if d % 2 == 1 and dt % 2 == 0 and d <= dt:
            print('No')
            exit()
        elif d % 2 == 0 and dt % 2 == 1 and d <= dt:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

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

for t, x, y in cordinates:
    # x+yは時刻t毎に偶奇が入れ替わる
    if (x+y) > t or ((x+y) % 2 and t % 2):
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

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

for t, x, y in cordinates:
    # x+yは時刻t毎に偶奇が入れ替わる
    if (x+y) > t or (x+y+t):
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
points = [tuple(map(int, input().split())) for i in range(N)]
points = [(0,0,0)] + points
for idx in range(1,N):
  time_diff = points[idx][0] - points[idx-1][0]
  x_diff = abs(points[idx][1] - points[idx-1][1])
  y_diff = abs(points[idx][2] - points[idx-1][2])
  
  if time_diff < x_diff + y_diff or (time_diff - x_diff - y_diff) % 2 == 1:
    print('NO')
    exit()
    
print('YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
points = [tuple(map(int, input().split())) for i in range(N)]
points = [(0,0,0)] + points
for idx in range(1,N):
  time_diff = points[idx][0] - points[idx-1][0]
  x_diff = abs(points[idx][1] - points[idx-1][1])
  y_diff = abs(points[idx][2] - points[idx-1][2])
  
  if time_diff < x_diff + y_diff or (time_diff - x_diff - y_diff) % 2 == 1:
    print('No')
    break
    
print('Yes')

Submission status: Wrong Answer

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

for _ in range(N):
    t, x, y = map(int, input().split())
    a = t - T
    b = abs(X - x)
    c = abs(Y - y)

    if a < b + c or a % 2 != (b + c) % 2:
        print('NO')
        exit()
    T, X, Y = t, x, y

print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())

f = True
for i in range(n):
  t,x,y = map(int,input().split())
  et = t
  exy = x+y
  et-=exy
  
  if(et>=0):
    if(et%2==0):
      continue
    else:
      f = False
      break
  else:
    f = False
    break

if (f):
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
N = int(input())

plist = [(0,0,0)]
for _ in range(N):
	plist.append(tuple(map(int, input().split())))

judge = 'Yes'
for i in range(N):
	mae = plist[i]
	usi = plist[i+1]

	time_diff = usi[0] - mae[0]
	road = abs(usi[1] - mae[1]) + abs(usi[2] - mae[2])

	amari = road % time_diff

	if amari % 2 != 0:
		judge = 'No'

print(judge)

Submission status: Wrong Answer

Solution code:
N = int(input())

plist = [(0,0,0)]
for _ in range(N):
	plist.append(tuple(map(int, input().split())))

judge = True
for i in range(N):
	mae = plist[i]
	usi = plist[i+1]

	time_diff = usi[0] - mae[0]
	road = abs(usi[1] - mae[1]) + abs(usi[2] - mae[2])

	amari = road % time_diff

	if amari % 2 != 0:
		judge =False

print(judge)

Submission status: Wrong Answer

Solution code:
import sys

default_x = 0
default_y = 0

n = int(input())
print(n)

a = []

#標準入力をN分読み込み
for i in range(n):
        a.append(list(map(int,input().split())))

times = 0
for i in range(n):
    for j in range(a[i][0]+times):
        if default_x < a[i][1]:
            default_x += 1
        elif default_x > a[i][1]:
            default_x -= 1

        elif default_y < a[i][2]:
            default_y += 1
        elif default_y > a[i][2]:
            default_y -= 1
        else:
            default_y -= 1

    if default_x != a[i][1] or default_y != a[i][2]:
        print('No')
        sys.exit()

    times  = a[i][0]

print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n,a=int(input()),[[0,0,0]]
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(n):
    b,c=abs(a[i+1][1]-a[i][1]+a[i+1][2]-a[i][2]),a[i+1][0]-a[i][0]
    if b<=c and b%2==c%2:
        print('Yes')
        sys.exit()
print('No')

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    N = int(input())
    t = [None]*N
    x = [None]*N
    y = [None]*N
    for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())
    flag=True
    if (t[0] - max(x[0], -x[0]) - max(y[0], -y[0])) %2 != 0 or t[0] < max(x[0], -x[0]) + max(y[0], -y[0]):
        print('No')
        flag = False
    
    for i in range(N-1):
        delta_t = t[i+1] - t[i]
        delta_x = x[i+1] - x[i]
        if delta_x < 0:
            delta_x = -delta_x
        delta_y = y[i+1] - y[i]
        if delta_y < 0:
            delta_y = -delta_y
        delta = delta_x + delta_y
        if (delta_t - delta) % 2 == 0 and delta_t >= delta:
            continue
        else:
            print('No')
            flag = False
            break
    if flag:
        print('Yes')

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    N = int(input())
    t = [None]*N
    x = [None]*N
    y = [None]*N
    for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())
    flag=True
    for i in range(N-1):
        delta_t = t[i+1] - t[i]
        delta_x = x[i+1] - x[i]
        if delta_x < 0:
            delta_x = -delta_x
        delta_y = y[i+1] - y[i]
        if delta_y < 0:
            delta_y = -delta_y
        delta = delta_x + delta_y
        if (delta_t - delta) % 2 == 0:
            continue
        else:
            print('No')
            flag = False
            break
    if flag:
        print('Yes')

Submission status: Wrong Answer

Solution code:
N=int(input())
i=0
 
flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  #unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  #unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])
  dt=afterTxy[0]-beforeTxy[0]
  dist=abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
 
  if dt>=dist and dt%2==dist%2:
    flag=1
  beforeTxy=afterTxy
  i=i+1

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

Submission status: Wrong Answer

Solution code:
N=int(input())
i=0
 
flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  #unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  #unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])
  dt=afterTxy[0]-beforeTxy[0]
  dist=abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
 
  if dt>=dist and dt%2==dist%2:
    flag=1
  beforeTxy=afterTxy
  i=i+1
 
if flag==0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
i=0
 
flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])
 
  if unk>=0 and unk%2!=0 and unk2%2!=0:
    flag=1
  beforeTxy=afterTxy
  i=i+1
 
if flag==0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
i=0

flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])

  if unk%2!=0 and unk2%2!=0:
    flag=1
  beforeTxy=afterTxy
  i=i+1

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

Submission status: Wrong Answer

Solution code:
N=int(input())
i=0

flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  if unk%2!=0:
    flag=1
  beforeTxy=afterTxy
  i=i+1

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

Submission status: Wrong Answer

Solution code:
N=int(input())
dst = [[0, 0, 0]]
for i in range(N):
    dst.append(input().split())
    
flag = True

for i in range(1, N+1):
    time_diff = int(dst[i][0])-int(dst[i-1][0])
    dst_diff = abs(int(dst[i][1])-int(dst[i-1][1]))+abs(int(dst[i][2])-int(dst[i-1][2]))
    if (time_diff>=dst_diff and (time_diff+2)%2 == (dst_diff+2)%2):
        print(i)
        print(int(dst[i][1]))
        print(int(dst[i-1][1]))
        print(int(dst[i][2]))
        print(int(dst[i-1][2]))
        flg = True
    else:
        flg = False
        break

print(int(dst[i][0])-int(dst[i-1][0]))        
print((int(dst[i][1])-int(dst[i-1][1])+int(dst[i][2])-int(dst[i-1][2])))

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

Submission status: Wrong Answer

Solution code:
N=input()
N=int(N)

flag=True
#時間経過
tk=0
#現在座標
xk=0
yk=0

for i in range(N):
    txy=input()
    #時間　x座標　y 座標
    t,x,y=txy.split()
    t=int(t)
    x=int(x)
    y=int(y)
    #時間に余裕があるか
    if abs(t-tk) >= abs(x-xk)+abs(y-yk):
        #偶数　奇数
        if (abs(t-tk)+abs(x-xk)+abs(y-yk))%2==0:
            print('Yes')
            flag=True
        else:
            flag=False
    else:
        flag=False
    
    tk=t
    xk=x
    yk=y
    
    if not flag:
        print('No')
        break

Submission status: Wrong Answer

Solution code:
N=input()
N=int(N)

flag=True
#時間経過
tk=0
#現在座標
xk=0
yk=0

for i in range(N):
    txy=input()
    #時間　x座標　y 座標
    t,x,y=txy.split()
    t=int(t)
    x=int(x)
    y=int(y)
    #時間に余裕があるか
    if abs(t-tk) >= abs(x-xk)+abs(y-yk):
        #偶数　奇数
        if (abs(t-tk)+abs(x-xk)+abs(y-yk))%2==0:
            print('Yes')
            flag=True
        else:
            print('No')
            flag=False
    else:
        print('No')
        flag=False
    
    tk=t
    xk=x
    yk=y
    
    if not flag:
        break

Submission status: Wrong Answer

Solution code:
N=input()
N=int(N)

flag=True
#時間経過
tk=0
#現在座標
xk,yk=0,0

for i in range(N):
    txy=input()
    #時間　x座標　y 座標
    t,x,y=txy.split()
    t=int(t)
    x=int(x)
    y=int(y)
    #時間に余裕があるか
    if abs(t-tk) >= abs(x-xk)+abs(y-yk):
        #偶数　奇数
        if (abs(t-tk)+abs(x-xk)+abs(y-yk))%2==0:
            print('Yes')
            flag=True
        else:
            print('No')
            flag=False
    else:
        print('No')
        flag=False
    
    tk=tk+t
    xk=xk+x
    yk=yk+y
    
    if not flag:
        break

Submission status: Wrong Answer

Solution code:
def check(x0, y0, x1, y1, s):
  dist = abs(x1 - x0) + abs(y1 - y0)
  if dist > s:
    return False
  if (dist + s) % 2 == 0:
    return True
  return False

N = int(input())
s0, x0, y0 = 0, 0, 0
ret = True
for i in range(N):
  s1, x1, y1 = map(int, input().split())
  if not check(x0, y0, x1, y1, s1 - s0):
    ret = False
    break
  s0, x0, y0 = x1, x1, y1
if ret:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
t = []
x = []
y = []
ans = "Yes"
tmpx = 0
tmpy = 0
tmpt = 0
for i in range(n):
    v1,v2,v3 = map(int,input().split())
    t.append(v1)
    x.append(v2)
    y.append(v3)
for i in range(n):
    if abs(tmpx-x[i]) + abs(tmpy-y[i]) <= t[i] - tmpt:
        tmpx = x[i]
        tmpy = y[i]
        tmpt = t[i]
        continue
    else:
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
t = []
x = []
y = []
ans = "Yes"
tmpx = 0
tmpy = 0
for i in range(n):
    v1,v2,v3 = map(int,input().split())
    t.append(v1)
    x.append(v2)
    y.append(v3)
for i in range(n):
    if abs(tmpx-x[i]) + abs(tmpy-y[i]) <= t[i]:
        tmpx = x[i]
        tmpy = y[i]
        continue
    else:
        flg = "No"
        break

Submission status: Wrong Answer

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

ans = "Yes"
for n in range(N-1):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt < dist) or ((dt - dist) % 2 == 1):
        ans = "No"

print(ans)

Submission status: Wrong Answer

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

ans = "Yes"
for n in range(N-1):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt < dist) or (dt % 2 != dist % 2):
        ans = "No"

print(ans)

Submission status: Wrong Answer

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

ans = "Yes"
for n in range(N-1):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt > dist) or (dt % 2 != dist % 2):
        ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
TS = [[0,0,0]] + [list(map(int, input().split())) for k in range(N)]
TS = sorted(TS)
result = True
for k in range(N):
    length = [TS[k+1][i] - TS[k][i] for i in range(3)]
    reminder = length[0] - (abs(length[1]) - abs(length[2]))
    result = result and (reminder >= 0) and (reminder % 2 == 0)
print("Yes") if result else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
TS = [[0,0,0]] + [list(map(int, input().split())) for k in range(N)]
result = True
for k in range(N):
    length = [TS[k+1][i] - TS[k][i] for i in range(3)]
    reminder = length[0] - (abs(length[1]) - abs(length[2]))
    result = result and (reminder >= 0) and (reminder % 2 == 0)
print("Yes") if result else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
TS = [[0,0,0]] + [list(map(int, input().split())) for k in range(N)]
result = True
for k in range(N):
    length = [TS[k+1][i] - TS[k][i] for i in range(3)]
    result = result and ((length[1] + length[2] - length[0]) % 2 == 0)
print("Yes") if result else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
TS = [[0,0,0]] + [list(map(int, input().split())) for k in range(N)]
result = True
for k in range(N):
    length = [TS[k+1][i] - TS[k][i] for i in range(3)]
    if (length[1] + length[2] - length[0]) % 2 == 0:
        result = result and result
print("Yes") if result 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) or (t+x+y)==1:
    print("No")
    exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

x_before = 0
y_before = 0
t_before = 0
ans = 'YES'

for i in range(N):
    t, x, y = map(int, input().split())
    
    #i番目とi+1番目までの距離
    distance = abs(x-x_before) + abs(y-y_before)
    
    #i番目とi+1番目までの時間
    time = t-t_before
    
    #i+1番目のtimeで行くことが可能か判定
    if time-distance<0:
        ans = 'NO'
        break
    if time%2 != distance%2:
        ans = 'NO'
        break
        
    #i+1番目のtimeで行くことが可能なら値を更新
    x_before = x
    y_before = y
    t_before = t
    
print(ans)