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:
def main():
    n = int(input())
    txy = [list(map(int, input().split())) for _ in range(n)]
    pre_x = 0
    pre_y = 0
    pre_t = 0
    for t, x, y in txy:
        dxy = abs(pre_x - x) + abs(pre_y - y)
        if t - pre_t >= dxy and (t - pre_t - dxy) % 2 == 0:
            continue
        else:
            print('No')
            break
        pre_x = x
        pre_y = y
        pre_t = t
    else:
        print('Yes')
        
        
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

        

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
for _ in range(n):
    t,x,y = map(int,input().split())
    if (t%2 != (x + y)%2) or (t%2 != (x + y)%2):
        print("No")
        exit()
    elif t < (x + y):
        print("No")
        exit()
    else:
        continue
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
now = 0
nowx = 0
nowy = 0
for i in range(N):
    t,x,y = map(int,input().split())
    if (t-now)%2 == 0:
        if (abs(x-nowx)+abs(y-nowy))%2 == 0:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
    else:
        if (abs(x-nowx)+abs(y-nowy))%2 == 1:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
now = 0
nowx = 0
nowy = 0
for i in range(N):
    t,x,y = map(int,input().split())
    if (t-now)%2 == 0:
        if abs(x-nowx)+abs(y-nowy)%2 == 0:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
    else:
        if abs(x-nowx)+abs(y-nowy)%2 == 1:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
S = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
    if S[i][1]+S[i][2]>S[i][0]:
        print("No")
        exit()
    else:
        if S[i][0]%2==0:
            if (S[i][1]+S[i][2])%2==1:
                print("No")
                exit()
        else:
            if (S[i][1]+S[i][2])%2==0:
                print("No")
                exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
timeNum = int(input())

placeSequence = list()
for pivot in range(timeNum):
  placeSequence.append(list(map(int, input().split(' '))))

def compatibleCoordinate(time, x, y):
  if time % 2 == (abs(x) +  abs(y) % 2) and time >= abs(x) + abs(y):
    return True
  else:
    return False

time = x = y = 0

for place in placeSequence:
  objectTime, objectX, objectY = place
  flag = compatibleCoordinate(objectTime-time, objectX-x, objectY-y)
  if flag:
    time = objectTime
    x = objectX
    y = objectY
    continue
  else:
    print('No')
    break

else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
timeNum = int(input())

placeSequence = list()
for pivot in range(timeNum):
  placeSequence.append(list(map(int, input().split(' '))))

def compatibleCoordinate(time, x, y):
  if time % 2 == (x + y % 2) and time >= abs(x) + abs(y):
    return True
  else:
    return False

time = x = y = 0

for place in placeSequence:
  objectTime, objectX, objectY = place
  flag = compatibleCoordinate(objectTime-time, objectX-x, objectY-y)
  if flag:
    time = objectTime
    x = objectX
    y = objectY
    continue
  else:
    print('No')
    break

else:
  print('Yes')

Submission status: Wrong Answer

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

tp = xp = yp = 0
for t, x, y in txy:
  ti = t - tp
  d = abs(x - xp) + abs(y - yp)
  if ti < d:
    print('No')
    exit()
  else:
    if ti % 2 != d % 2:
      print('No')
      exit()
    else:
      continue
    
print('Yes')

Submission status: Wrong Answer

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

for t, x, y in txy:
  if t < x + y:
    print('No')
    exit()
  else:
    if t % 2 != (x + y) % 2:
      print('No')
      exit()
    else:
      continue
    
print('Yes')

Submission status: Wrong Answer

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

    for i in range(1,N+1):
        # 空間的に可能かどうか。奇数秒後はx+yが奇数に、偶数秒後はx+yが偶数にならないといけない。
        if (t[i]%2==0 and (x[i]+y[i])%2==1) or (t[i]%2==1 and (x[i]+y[i])%2==0):
            print('No')
            exit()
        #　時間的に可能かどうか。
        if (t[i] - t[i-1]) < (x[i] - x[i-1]) + (y[i] - y[i-1]):
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:

n = int(input())
travel = []

for i in range(n):
    array = list(map(int, input().strip().split()))
    travel.append(array)


def func(num: int, query):
    initial = [0, 0, 0]
    for j in range(n):
        if (query[j][0] % 2 == 0 and not (query[j][1] + query[j][2]) % 2 == 0) or \
                (not query[j][0] % 2 == 0 and (query[j][1] + query[j][2]) % 2 == 0) or \
                query[j][1] + query[j][2] > query[j][0]:

            return print('No')

        elif (query[j][0] % 2 == 0 and (query[j][1] + query[j][2]) % 2 == 0) or \
                (not query[j][0] % 2 == 0 and not (query[j][1] + query[j][2]) % 2 == 0) and \
                query[j][1] + query[j][2] <= query[j][0] and \
                j + 1 == num:

            if j == 0:
                temp_time = query[j][0] - initial[0]
                if 0 <= query[j][1] + query[j][2] - (initial[1] - initial[2]) <= temp_time:
                    return print('Yes')
                else:
                    return print('No')

            if j > 0:
                temp_time = query[j][0] - query[j-1][0]
                if 0 <= abs(query[j][1] + query[j][2] - (query[j-1][1] + query[j-1][2])) <= temp_time:
                    return print('Yes')
                else:
                    return print('No')


func(num=n, query=travel)

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 or (x + y + t) % 2:
        flag = False

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

Submission status: Wrong Answer

Solution code:
N = int(input())

p = [[ 0 for i in range(3)] for j in range(N+1)]

for i in range(1,N+1):
    p[i][0], p[i][1], p[i][2] = map(int,input().split())

cant = True

if p[1][0] % 2 == (p[1][1] + p[1][2]) % 2 and p[1][0] >= p[1][1] + p[1][2]:
    cant = False

if cant:
    print('No')
    exit()

if N > 1:
    for i in range(1, N+1):
        ts = p[i][0] - p[i-1][0]
        ps = p[i][1] - p[i-1][1] + p[i][2] - p[i-1][2]
        if ts%2 == ps%2 and ts >= ps:
            cant = False
        else:
            print('No')
            exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())

p = [[ 0 for i in range(3)] for j in range(N+1)]

for i in range(1,N+1):
    p[i][0], p[i][1], p[i][2] = map(int,input().split())

cant = True

if p[1][0] % 2 == (p[1][1] + p[1][2]) % 2 and p[1][0] >= p[1][1] + p[1][2]:
    cant = False

if cant:
    print('NO')
    exit()

if N > 1:
    for i in range(1, N+1):
        ts = p[i][0] - p[i-1][0]
        ps = p[i][1] - p[i-1][1] + p[i][2] - p[i-1][2]
        if ts%2 == ps%2 and ts >= ps:
            cant = False
        else:
            print('NO')
            exit()

print('YES')

Submission status: Wrong Answer

Solution code:

n = int(input())
travel = []

for i in range(n):
    array = list(map(int, input().strip().split()))
    travel.append(array)


def func(num: int, query):
    for j in range(n):
        if (query[j][0] % 2 == 0 and not (query[j][1] + query[j][2]) % 2 == 0) or \
                (not query[j][0] % 2 == 0 and (query[j][1] + query[j][2]) % 2 == 0) or \
                query[j][1] + query[j][2] > query[j][0]:

            return print('No')

        elif (query[j][0] % 2 == 0 and (query[j][1] + query[j][2]) % 2 == 0) or \
                (not query[j][0] % 2 == 0 and not (query[j][1] + query[j][2]) % 2 == 0) and \
                query[j][1] + query[j][2] <= query[j][0] and \
                j + 1 == num:

            return print('Yes')


func(num=n, query=travel)

Submission status: Wrong Answer

Solution code:

n = int(input())
trip = []

for i in range(n):
    array = list(map(int, input().strip().split()))
    trip.append(array)


def func(num: int, query):
    for j in range(len(query)):
        if (query[j][0] % 2 == 0 and not (query[j][1] + query[j][2]) % 2 == 0) or \
                (not query[j][0] % 2 == 0 and (query[j][1] + query[j][2]) % 2 == 0) or \
                query[j][1] + query[j][2] > query[j][0]:

            return print('No')

        elif (query[j][0] % 2 == 0 and (query[j][1] + query[j][2]) % 2 == 0) or \
                (not query[j][0] % 2 == 0 and not (query[j][1] + query[j][2]) % 2 == 0) and \
                query[j][1] + query[j][2] <= query[j][0] and \
                j + 1 == num:

            return print('Yes')


func(num=n, query=trip)

Submission status: Wrong Answer

Solution code:

n = int(input())
trip = []

for i in range(n):
    array = list(map(int, input().strip().split()))
    trip.append(array)


def func(num: int, query):
    for j in range(len(query)):
        if (query[j][0] % 2 == 0 and not (query[j][1] + query[j][2]) % 2 == 0) or \
                (not query[j][0] % 2 == 0 and (query[j][1] + query[j][2]) % 2 == 0) or \
                query[j][1] + query[j][2] > query[j][0]:

            return print('No')

        elif (query[j][0] % 2 == 0 and (query[j][1] + query[j][2]) % 2 == 0) or \
                (not query[j][0] % 2 == 0 and not (query[j][1] + query[j][2]) % 2 == 0) and \
                query[j][1] + query[j][2] <= query[j][0] and \
                j + 1 == num:

            return print('YES')


func(num=n, query=trip)

Submission status: Wrong Answer

Solution code:
N = int(input())
cs = []
t1, x1, y1 = 0, 0, 0
ans = 'Yes'
for i in range(N):
  t2, x2, y2 = map(int, input().split())
  d = abs(x1-x2) + abs(y1-y2)
  if d == 0 or d > (t2 - t1) or d % 2 != (t2 - t1) % 2:
    ans = 'No'
    break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
cs = []
t1, x1, y1 = 0, 0, 0
ans = 'Yes'
for i in range(N):
  t2, x2, y2 = map(int, input().split())
  d = abs(x1-x2) + abs(y1-y2)
  if d == 0 or d > (t2 - t1) or d % 2 != (t2 - t1) % 2:
    ans = 'No'
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
cs = []
t1, x1, y1 = 0, 0, 0
ans = 'Yes'
for i in range(N):
  t2, x2, y2 = map(int, input().split())
  d = abs(x1-x2) + abs(y1-y2)
  if d > (t2 - t1) or d % 2 != (t2 - t1) % 2:
    ans = 'No'
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
cs = []
t1, x1, y1 = 0, 0, 0
ans = 'Yes'
for i in range(N):
  t2, x2, y2 = map(int, input().split())
  d = abs(x1-x2) + abs(y1+y2)
  if d > (t2 - t1) or d % (t2 - t1):
    ans = 'No'
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
t1 = 0
x1 = 0
y1 = 0
for i in range(N):
  t2,x2,y2=map(int,input().split())
  d = abs(x1 - x2) + abs(y1 - y2)
  dt = t2 - t1
  if d > dt:
    print('No')
    exit()
  if dt%2!=0 and d==0:
    print('No')
    exit()
  if dt%2==0 and d==1:
    print('No')
    exit()
  t1,x1,y1=t2,x2,y2
print('Yes')

Submission status: Wrong Answer

Solution code:
N=int(input())
t1 = 0
x1 = 0
y1 = 0
for i in range(N):
  t2,x2,y2=map(int,input().split())
  d = abs(x1 - x2) + abs(y1 - y2)
  dt = t2 - t1
  if d > dt:
    print('No')
    exit()
  if dt%2!=0 and d==0:
    print('No')
    exit()
  t1,x1,y1=t2,x2,y2
print('Yes')

Submission status: Wrong Answer

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

t = []
cordinate = []

#　リストtに時間の情報、二次元配列のcordinateにx,y座標を入れる
for i in range(N):
    time,x,y = map(int, input().split())
    t.append(time)
    cordinate.append([x,y])

# 初期の時間と初期座標
time = 0
x,y = 0,0


for i in range(len(t)):
    
    # 移動先への移動にかけて良い時間
    time = abs(time - t[i])
    
    #移動先のx,y座標
    objx = cordinate[i][0]
    objy = cordinate[i][1]
    

    
    #移動できる時間より距離が長い場合はアウト
    if time < abs((objx - x) + (objy - y)):
        print("No")
        sys.exit()
    
    #偶奇の判定
    if (abs((objx - x) + (objy - y)))%2 != time % 2:
        print("No")
        sys.exit()

    x,y = objx,objy

print("Yes")

Submission status: Wrong Answer

Solution code:
import sys 
N = int(input())
 
t = []
cordinate = []
 
for i in range(N):
    time,x,y = map(int, input().split())
    t.append(time)
    cordinate.append([x,y])
 
time = 0
x,y = 0,0
for i in range(len(t)):
    time = abs(time - t[i])
    objx = cordinate[i][0]
    objy = cordinate[i][1]
    
 
    
 
    if time < abs((objx - x) + (objy - y)):
        print("No")
        sys.exit()
    
    #ここ
    if (abs((objx - x) + (objy - y)) %2) != time % 2:
        print("No")
        sys.exit()
 
    x = objx
    y = objy 
 
print("Yes")

Submission status: Wrong Answer

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

t = []
cordinate = []

for i in range(N):
    time,x,y = map(int, input().split())
    t.append(time)
    cordinate.append([x,y])

time = 0
x,y = 0,0
for i in range(len(t)):
    time = abs(time - t[i])
    objx = cordinate[i][0]
    objy = cordinate[i][1]
    

    

    if time < abs((objx - x) + (objy - y)):
        print("No")
        sys.exit()
    
    #ここ
    if (abs((objx - x) + (objy - y)) %2) != time % 2:
        print("No")
        sys.exit()

    x,y = objx,objy

print("Yes")

Submission status: Wrong Answer

Solution code:
N, *T = map(int, open(0).read().split())
d_t, d_x, d_y = 0, 0, 0
for t, x, y in zip(T[::3], T[1::3], T[2::3]):
    dist = abs(d_x - x) + abs(d_y - y)
    if (t - d_t - dist) % 2:
        print("No")
        break
    d_t, d_x, d_y = t, x, y
else:
    print("Yes")

Submission status: Wrong Answer

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

ans="Yes"
for i in range(N-1):
  t_now=tra[i][0]
  x_now=tra[i][1]
  y_now=tra[i][2]
  
  t_next=tra[i+1][0]
  x_next=tra[i+1][1]
  y_next=tra[i+1][2]
  
  mind=abs(x_now-x_next)+abs(y_now-y_next)
  tdis=t_next-t_now
  
  # 遠すぎて移動できないときと、時間差と距離の偶奇が不一致の時アウト
  if mind>tdis or (mind+tdis)%2==1:
    ans="No"
    break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = "Yes"
now_x = 0
now_y = 0
now_t = 0

for i in range(n):
  x,y,t = map(int,input().split())
  
  if abs(now_x-x)+abs(now_y-y) < (t-now_t):
    ans = "No"
    break
    
  if (abs(now_x-x)+abs(now_y-y)-(t-now_t))%2 == 1:
    ans = "No"
    break
    
  now_x = x
  now_y = y
  now_t = t
    
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
data = [[int(__) for __ in input().split()] for _ in range(N)]


data.insert(0, [0, 0, 0])
canTravel = True

for i in range(1, N+1):
    absT = data[i][0] - data[i-1][0]
    absX = data[i][1] - data[i-1][1]
    absY = data[i][2] - data[i-1][2]

    distance = absX + absY
    if absT < distance or absT % 2 != distance % 2:
        canTravel = False
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
data = [[int(__) for __ in input().split()] for _ in range(N)]


data.insert(0, [0, 0, 0])
canTravel = True


def diff(nowData, oldData):
    absT = abs(nowData[0] - oldData[0])
    absX = abs(nowData[1] - oldData[1])
    absY = abs(nowData[2] - oldData[2])
    return [absT, absX, absY]


for index, d in enumerate(data):
    if index == 0:
        continue
    else:
        absT, absX, absY = diff(d, data[index - 1])
        distance = absX + absY
        if absT < distance or absT % 2 != distance % 2:
            canTravel = False
            break

if canTravel:
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

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

flag = 0
for i in range(1,n+1):
    dt = t[i] - t[i-1]
    dx = x[i] - x[i-1]
    dy = y[i] - y[i-1]
    dist = abs(dx) + abs(dy)
    if dist > dt:
        flag = flag +1
    elif dist % 2 != 0 and dt % 2 != 0:
        flag = flag +1
else:
    print("Yes" if flag ==0 else "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:
        print("No")
        exit()
    if (x+y) % 2 == 0 and t % 2 == 0:
        continue
    elif (x+y) % 2 != 0 and t % 2 != 0:
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [input().split() for _ in range(N)]

if N ==1:
  n = int(A[0][0])
  move = int(A[0][1]) + int(A[0][2]) 
  if move > n or move%2 != n%2:
    print("NO")
  else:
    print("YES")
  
for i in range(1,N):
  H = abs(int(A[i][1]) - int(A[i -1][1]))
  V = abs(int(A[i][2]) - int(A[i -1][2]))
  move = H + V
  n = int(A[i][0]) - int(A[i -1][0])
  if move > n or move%2 != n%2:
    print("NO")
    break
  elif i == N -1:
    print("YES")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [input().split() for _ in range(N)]

if N ==1:
  n = int(A[0][0])
  move = int(A[0][1]) + int(A[0][2]) 
  if move > n or move%2 != n%2:
    print("NO")
  else:
    print("YES")
  
for i in range(1,N):
  H = int(A[i][1]) - int(A[i -1][1])
  V = int(A[i][2]) - int(A[i -1][2])
  move = H + V
  n = int(A[i][0]) - int(A[i -1][0])
  if move > n or move%2 != n%2:
    print("NO")
    break
  elif i == N -1:
    print("YES")

Submission status: Wrong Answer

Solution code:
before = 0, 0, 0
for _ in range(int(input())):
    tt, tx, ty = map(int, input().split())
    bt, bx, by = before
    distance = abs(tx - bx) + abs(ty - by)
    t = tt - bt
    if tt <= distance or t % 2 != distance % 2:
        break
    before = tt, tx, ty
else:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

Solution code:
before = 0, 0, 0
for _ in range(int(input())):
    tt, tx, ty = map(int, input().split())
    bt, bx, by = before
    distance = abs(tx - bx) + abs(ty - by)
    t = tt - bt
    if tt < distance or t % 2 != distance % 2:
        break
    before = tt, tx, ty
else:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

bt, bx, by = 0, 0, 0
flg = True

for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time<dist or time%2!=dist%2:
        flg = False
        print('No')
        break
    bt, bx, xy = t, x, y
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())

bt, bx, by = 0, 0, 0
flg = True

for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time<dist or time%2!=dist%2:
        flg = False
        break
    else:
        bt, bx, xy = t, x, y

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

Submission status: Wrong Answer

Solution code:
N = int(input())

bt, bx, by = 0, 0, 0
flg = True

for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time<dist and time%2!=dist%2:
        flg = False
        break
    else:
        bt, bx, xy = t, x, y

if flg:
    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)
t_diff=0; x_diff=0; y_diff=0

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

flag = True

for i in range(N):
    t_diff = t[i+1]-t[i]
    diff = abs(x[i+1]-x[i]) +  abs(y[i+1]-y[i])
    if t_diff%2 == diff%2 and t[i+1] >= (x[i+1]+y[i+1]):
        continue
    else:
        flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

bt, bx, by = 0, 0, 0
flg = True
for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time>=dist and time%2==dist%2:
        bt, bx, xy = t, x, y
    else:
        flg = False
        break

if flg:
    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)
t_diff=0; x_diff=0; y_diff=0

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

for i in range(N):
    t_diff = t[i+1]-t[i]
    diff = abs(x[i+1]-x[i]) +  abs(y[i+1]-y[i])
    if t_diff%2 != diff%2 or t[i+1] < (x[i+1]+y[i+1]):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

bt, bx, by = 0, 0, 0
flg = True
for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time>=dist and (time-dist)%2==0:
        bt, bx, xy = t, x, y
    else:
        flg = False
        break

if flg:
    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)
t_diff=0; x_diff=0; y_diff=0

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

for i in range(N):
    t_diff = t[i+1]-t[i]
    x_diff = abs(x[i+1]-x[i])
    y_diff = abs(y[i+1]-y[i])
    if t_diff%2 != (x_diff+y_diff)%2 or t[i+1] < (x[i+1]+y[i+1]):
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t=[0]*(N+1); x=[0]*(N+1); y=[0]*(N+1)
t_diff=0; x_diff=0; y_diff=0

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

print(t, x, y)

for i in range(N):
    t_diff = t[i+1]-t[i]
    x_diff = abs(x[i+1]-x[i])
    y_diff = abs(y[i+1]-y[i])
    if t_diff%2 != (x_diff+y_diff)%2 or t[i+1] < (x[i+1]+y[i+1]):
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
x=y=t=0
flag=True
for i in range(N):
  ti, xi, yi = map(int, input().split())
  dist = abs(xi-x)+abs(yi-y)
  dt = ti-t
  x, y, t = xi, yi, ti
  if dist<=dt and dist%2==dt%2:
    continue
  else:
    print(i,dist,dt)
    flag=False
print("Yes") if flag else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
t=[0]*(N+1); x=[0]*(N+1); y=[0]*(N+1)
t_diff=0; x_diff=0; y_diff=0

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

# print(t, x, y)

for i in range(N):
    t_diff = t[i+1]-t[i]
    x_diff = abs(x[i+1]-x[i])
    y_diff = abs(y[i+1]-y[i])
    if t_diff%2 != (x_diff+y_diff)%2 or t[-1] <= (x[-1]+y[-1]):
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t=[0]*(N+1); x=[0]*(N+1); y=[0]*(N+1)
t_diff=0; x_diff=0; y_diff=0

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

# print(t, x, y)

for i in range(N):
    t_diff = t[i+1]-t[i]
    x_diff = abs(x[i+1]-x[i])
    y_diff = abs(y[i+1]-y[i])
    if t_diff%2 != (x_diff+y_diff)%2 or t[-1] < (x[-1]+y[-1]):
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
x=y=t=0
flag=True
for i in range(N):
  ti, xi, yi = map(int, input().split())
  dist = abs(xi-x)+abs(yi-y)
  dt = ti-t
  x, y = xi, yi
  if dist<=dt and dist%2==dt%2:
    continue
  else:
    flag=False
print("Yes") if flag else print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
x=y=t=0
flag=True
for i in range(N):
  ti, xi, yi = map(int, input().split())
  dist = abs(xi-x)+abs(yi-y)
  dt = ti-t
  x, y = xi, yi
  if dist<=t and dist%2==dt%2:
    continue
  else:
    flag=False
print("Yes") if flag else print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
x=y=0
flag=True
for i in range(N):
  t, xi, yi = map(int, input().split())
  dist = abs(xi-x)+abs(yi-y)
  if dist<=t and dist%2==t%2:
    continue
  else:
    flag=False
print("Yes") if flag else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
t=[0]*(N+1); x=[0]*(N+1); y=[0]*(N+1)
t_diff=0; x_diff=0; y_diff=0

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

# print(t, x, y)

for i in range(N):
    t_diff = t[i+1]-t[i]
    x_diff = x[i+1]-x[i]
    y_diff = y[i+1]-y[i]
    if t_diff%2 != (x_diff+y_diff)%2 or t[-1] < (x[-1]+y[-1]):
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t=[0]*(N+1); x=[0]*(N+1); y=[0]*(N+1)
t_diff=0; x_diff=0; y_diff=0

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

# print(t, x, y)

for i in range(N):
    t_diff += t[i+1]-t[i]
    x_diff += x[i+1]-x[i]
    y_diff += y[i+1]-y[i]
    if t_diff%2 != (x_diff+y_diff)%2 or t[-1] <= (x[-1]+y[-1]):
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t=[0]*(N+1); x=[0]*(N+1); y=[0]*(N+1)
t_diff=0; x_diff=0; y_diff=0

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

# print(t, x, y)

for i in range(N):
    t_diff += t[i+1]-t[i]
    x_diff += x[i+1]-x[i]
    y_diff += y[i+1]-y[i]
    if t_diff%2 != (x_diff+y_diff)%2 or t[-1] < (x[-1]+y[-1]):
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t=[0]*(N+1); x=[0]*(N+1); y=[0]*(N+1)
t_diff=0; x_diff=0; y_diff=0

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

print(t, x, y)

for i in range(N):
    t_diff += t[i+1]-t[i]
    x_diff += x[i+1]-x[i]
    y_diff += y[i+1]-y[i]
    if t_diff%2 != (x_diff+y_diff)%2 or t[-1] < (x[-1]+y[-1]):
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

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

T=X=Y=0
ok = True
for t,x,y in txy:
  if abs(X-x)+abs(Y-y) <= t-T:
    if (t-T)%2 == 0:
      if (abs(X-x)+abs(Y-y))%2!=0:
        ok = False
        break
    else:
      if (abs(X-x)+abs(Y-y))%2==0:
        ok = False
        break
  else:
    ok = False
    break
print("Yes" if ok else "No")

Submission status: Wrong Answer

Solution code:
N = int(input())
t=[0]*N; x=[0]*N; y=[0]*N
t_diff=0; x_diff=0; y_diff=0

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

for i in range(N-1):
    t_diff += t[i+1]-t[i]
    x_diff += x[i+1]-x[i]
    y_diff += y[i+1]-y[i]
    
if t_diff%2 == (x_diff+y_diff)%2 and t[-1] > (x[-1]+y[-1]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

now = [0, 0]
time = 0

for i in range(n):
    array = list(map(int, input().split()))
    dist = abs(now[0] - array[1]) + abs(now[1] - array[2])
    time_diff = array[0] - time
    if time_diff < dist:
        print('No')
        exit()
    else:
        if dist%2 == time_diff%2:
            continue
        else:
            print('No')
            exit()
    time = array[0]
    now = [array[1], array[2]]

print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

now = [0, 0]
time = 0

for i in range(n):
    array = list(map(int, input().split()))
    dist = abs(now[0] - array[1]) + abs(now[1] - array[2])
    time_diff = array[0] - time
    if time_diff < dist:
        print('No')
        exit()
    else:
        if dist%2 == time_diff%2:
            continue
        else:
            print('No')
            exit()
        time = array[0]

print('Yes')

Submission status: Wrong Answer

Solution code:
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
flag = 0
for i in range(1,N):
    dx = dist(X[i][1:],X[i-1][1:])
    dt = X[i][0]-X[i-1][0]
    if dt>=dx and (dt-dx)%2==0:
        continue
    else:
        flag = 1
        break
if flag==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

bt, bx, by = 0, 0, 0
flg = True
for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    if t<bt:
        flg = False
        break
    time = t-bt
    if time>=dist and (time-dist)%2==0:
        bt, bx, xy = t, x, y
    else:
        flg = False
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = "Yes"
X = 0
Y = 0
T = 0
for _ in range(N):
    t,x,y = map(int, input().split())
    dt = t-T
    d = abs(X-x)+abs(Y-y)-dt
    if d > 0 or d%2 == 1:
        ans = "No"
    T += t
    X = x
    Y = y

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = "Yes"
X = 0
Y = 0
for _ in range(N):
    t,x,y = map(int, input().split())
    d = abs(X-x)+abs(Y-y)-t
    if d > 0 or d%2 == 1:
        ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

bt=0
bx=0
by=0
ans='Yes'
for i in range(n):
  t,x,y=map(int,input().split())
  dt=t-bt
  dx=x-bx
  dy=y-by

  if (dx+dy)>dt:
    ans='No'
  elif (dt-(dx+dy))%2==1:
    ans='No'

  bt=t
  bx=x
  by=y

print(ans)