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

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 = abs(t-t_before)
    
    #i+1番目のtimeで行くことが可能か判定
    if((time-distance<0) or ((time-distance)%2 != 0)):
        ans = 'NO'
        break
        
    #i+1番目のtimeで行くことが可能なら値を更新
    x_before = x
    y_before = y
    t_before = t
    
print(ans)

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番目までの距離
    distace = abs(x-x_before) + abs(y-y_before)
    
    #i番目とi+1番目までの時間
    time = abs(t-t_before)
    
    #i+1番目のtimeで行くことが可能か判定
    if((time-distace<0) or (time-distace%2!=0)):
        ans = 'NO'
        break
        
    #i+1番目のtimeで行くことが可能なら値を更新
    x_before = x
    y_before = y
    t_before = t
    
print(ans)

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-1番目とi番目までの距離
    abs_distace = abs(x-x_before) + abs(y-y_before)
    
    #i-1番目とi番目までの時間
    abs_time = abs(t-t_before)
    
    #i番目のtimeで行くことが可能か判定
    if((abs_time-abs_distace)<0 or (abs_time-abs_distace)%2!=0):
        ans = 'NO'
        break
        
    #i番目のtimeで行くことが可能なら値を更新
    x_before = x
    y_before = y
    t_before = t
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

x_before = 0
y_before = 0
ans = 'YES'

for i in range(N):
    t, x, y = map(int, input().split())
    abs_distace = abs(x) + abs(y)
    if((t-abs(t-abs_distace)>=0) and (t-abs_distace)%2!=0):
        ans = 'NO'
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
x_before = 0
y_before = 0
ans = 'YES'

for i in range(N):
    t, x, y = map(int, input().split())
    abs_distace = abs(x) + abs(y)
    if((t-abs_distace)%2!=0):
        ans = 'NO'
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
timeline=[[0,0,0]]

for i in range(n):
	temp=list(input().rstrip().split())
	temp2=[]
	for element in temp:
		temp2.append(int(element))
	timeline.append(temp2)


i=0
flag=True

while i<n and flag:
	dif=[timeline[i+1][0]-timeline[i][0],timeline[i+1][1]-timeline[i][1],timeline[i+1][2]-timeline[i][2]]
	if dif[0]<abs(dif[1])+abs(dif[2]) or (abs(dif[1])+abs(dif[2])-dif[0])%2 ==1 :
		flag=False
	i+=1

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

Submission status: Wrong Answer

Solution code:
n=int(input())
timeline=[[0,0,0]]

for i in range(n):
	temp=list(input().rstrip().split())
	temp2=[]
	for element in temp:
		temp2.append(int(element))
	timeline.append(temp2)


i=0
flag=True

while i<n and flag:
	dif=[timeline[i+1][0]-timeline[i][0],timeline[i+1][1]-timeline[i][1],timeline[i+1][2]-timeline[i][2]]
	if dif[0]<dif[1]+dif[2] or (dif[1]+dif[2]-dif[0])%2 ==1 :
		flag=False
	i+=1

if flag:
	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 (x + y + t) % 2:
        print("NO")
        exit()
print("YES")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [[0, 0, 0]]
[txy.append(list(map(int, input().split()))) for x in range(n)]
flag = True
for i in range(n):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1] + txy[i + 1][2] - txy[i][2])
    if dt < dist:
        flag = False
    elif dt >= dist and dist % 2 != dt % 2:
        flag = False
if flag:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [[0, 0, 0]]
[txy.append(list(map(int, input().split()))) for x in range(n)]
flag = True
for i in range(n):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1] + txy[i + 1][2] - txy[i][2])
    if dt < dist:
        flag = False
        break
    elif dt >= dist and dist % 2 != dt % 2:
        flag = False
        break
if flag:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [[0, 0, 0]]
[txy.append(list(map(int, input().split()))) for x in range(n)]
flag = True
for i in range(n):
    dt = abs(txy[i + 1][0] - txy[i][0])
    dist = abs(txy[i + 1][1] - txy[i][1] + txy[i + 1][2] - txy[i][2])
    if dt < dist:
        flag = False
        break
    elif dist % 2 != dt % 2:
        flag = False
        break
if flag:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int, input().split())) for x in range(n)]
flag = True
for i in range(n - 1):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1] + txy[i + 1][2] - txy[i][2])
    if dt < dist:
        flag = False
        break
    elif dist % 2 != dt % 2:
        flag = False
        break
if flag:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int, input().split())) for x in range(n)]
flag = True
for i in range(n):
    if txy[i][0] < txy[i][1] + txy[i][2]:
        flag = False
        break
    elif txy[i][0] % 2 != (txy[i][1] + txy[i][2]) % 2:
        flag = False
        break
if flag:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import numpy as np

input_line = int(input())
s = np.zeros((input_line,3))
for i in range(input_line):
  s[i] = input().rstrip().split(' ')

for i in range(input_line):
    list_sum = s[i,1] + s[i,2]
    if s[i,0] < list_sum or list_sum%2 != 0 or list_sum % 4 == s[i,0] % 4 :
        result = "Yes"
        break
    else:
        result = "No"

print(result)

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
T = [[0 for i in range(3)] for j in range(N)]
for i in range(3):
    T = [[0,0,0]]
for i in range(1,N+1):
    row = input().split()
    for j in range(len(row)):
        row[j] = int(row[j])
    T.append(row)

for i in range(N):
    dist = abs(T[i+1][1]-T[i][1]) + abs(T[i+1][2]-T[i][2])
    time = T[i+1][0]- T[i][0]

    if dist > time or (dist - time) % 2 == 1:
        print("NO")
        sys.exit()

print("YES")

Submission status: Wrong Answer

Solution code:
def is_reachable(time, x, y):
  if time < x + y:
    return False
  if (time - x - y) % 2 == 0:
    return True
  else:
    return False
  
N=int(input())
X=[list(map(int, input().split())) for i in range(N)]
t = 0
x = 0
y = 0
for i in range(N):
  if is_reachable(X[i][0]-t, X[i][1]-x, X[i][2]-y):
    t += X[i][0]
    x += X[i][1]
    y += X[i][2]
  else:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
# coding: utf-8

n = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())
before_t = before_x = before_y = 0
for _ in range(N):
  t, x, y = map(int, input().split())
  distance = abs(x-before_x) + abs(y-before_y)
  diff_t = t-before_t
  if diff_t < distance or diff_t%2 != 0:
    print('No')
    exit()
  before_t = t
  before_x = x
  before_y = y
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
even=(2*k for k in range(10**6))
a=[[0,0,0]]
for i in range(n):
  a.append(list(map(int,input().split())))
for i in range(n):
  if (a[i+1][0]-a[i][0])-abs(a[i+1][1]-a[i][1])-abs(a[i+1][2]-a[i][2]) in even:
    continue
  else:
    print('No')
    exit()
print('Yes')

Submission status: Wrong Answer

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

t, x, y = 0, 0, 0
for i in place:
  next_t, next_x, next_y = i
  rest = (next_t - t) % (abs(next_x - x) + abs(next_y - y))
  if (next_t - t) < (abs(next_x - x) + abs(next_y - y)):
    print('No')
    exit()
  elif rest % 2 == 0 or rest == 0:
    continue 
  else:
    print('No')
    exit()
  t, x, y = next_t, next_x, next_y

print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

f = False
for i in range(n):
    t, x, y = list(map(int, input().split()))
    if f:
        continue
    if t < x + y:
        print('NO')
        f = True
        # exit()
    if t % 2 == 0 and (x + y) % 2 == 1:
        print('NO')
        f = True
        # exit()
    if t % 2 == 1 and (x + y) % 2 == 0:
        print('NO')
        f = True
        # exit()
if not f:
    print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(n):
    t, x, y = list(map(int, input().split()))
    if t < x + y:
        print('NO')
        exit()
    if t % 2 == 0 and (x + y) % 2 == 1:
        print('NO')
        exit()
    if t % 2 == 1 and (x + y) % 2 == 0:
        print('NO')
        exit()

print('YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N
for i in range(0, N-1):
    t[i], x[i], y[i] = map(int, input().split())
    if i == 0:
        dt = t[i]
        dx = x[i]
        dy = y[i]
    else:
        dt = t[i] - t[i-1]
        dx = x[i] - x[i-1]
        dy = y[i] - y[i-1]

    dist = abs(dx) + abs(dy)

    if dt < dist or (dt - dist) % 2 != 0:
        print('No')
    else:
        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())
    if(N == 1):
        dt = t[i]
        dx = x[i]
        dy = y[i]
    else:
        dt = t[i] - t[i-1]
        dx = x[i] - x[i-1]
        dy = y[i] - y[i-1]
        
    dist = abs(dx) + abs(dy)
    
    if(dt < dist or (dt - dist) % 2 != 0):
        print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:
def find(b, c, d):
    min_path = c + d
    cnt = 0

    for i in range(-50, 50):
        act_path = min_path + 2 * i
        if(act_path == b):
            cnt += 1
        else:
            cnt += 0

    return cnt


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

count = 0

for i in range(N):
    if(i == 0):
        diff_t = t[i]
        diff_x = x[i]
        diff_y = y[i]
    else:
        diff_x = x[i] - x[i-1]
        diff_y = y[i] - y[i-1]
        diff_t = t[i] - t[i-1]

    count += find(diff_t, diff_x, diff_y)

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

Submission status: Wrong Answer

Solution code:
#86

#入力（1次元）
N = int(input())
#入力（２次元）
X = []
for i in range(N):
    X.append(list(map(int, input().split())))

ans = 'Yes'

for i in range(N):
    t = X[i][0] - X[i][1]- X[i][2]
    if t < 0 or X[i][0] % (X[i][1] + X[i][2]) != 0 :
        ans = 'No'

print(ans)

Submission status: Wrong Answer

Solution code:
def find(b, c, d):
    min_path = c + d
    cnt = 0

    for i in range(-50, 50):
        act_path = min_path + 4 * i
        if(act_path == b):
            cnt += 1
        else:
            cnt += 0

    return cnt


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

count = 0

for i in range(N):
    if(i == 0):
        diff_t = t[i]
        diff_x = x[i]
        diff_y = y[i]
    else:
        diff_x = x[i] - x[i-1]
        diff_y = y[i] - y[i-1]
        diff_t = t[i] - t[i-1]

    count += find(diff_t, diff_x, diff_y)

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

Submission status: Wrong Answer

Solution code:

def find(b, c, d):
    min_path = c + d
    cnt = 0

    for i in range(1000):
        act_path = min_path + 4 * i
        if(act_path == b):
            cnt += 1
        else:
            cnt += 0

    return cnt


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

count = 0

for i in range(N):
    diff_x = x[i] - x[i-1]
    diff_y = y[i] - y[i-1]
    diff_t = t[i] - t[i-1]

    count += find(diff_t, diff_x, diff_y)

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

Submission status: Wrong Answer

Solution code:

def find(b, c, d):
    min_path = c + d
    cnt = 0

    for i in range(100):
        act_path = min_path + 4 * i
        if(act_path == b):
            cnt += 1
        else:
            cnt += 0

    return cnt


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

count = 0

for i in range(N):
    diff_x = x[i] - x[i-1]
    diff_y = y[i] - y[i-1]
    diff_t = t[i] - t[i-1]

    count += find(diff_t, diff_x, diff_y)

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

Submission status: Wrong Answer

Solution code:
N = int(input())

T = 0
X = Y = 0
Flag = 'Even'

for n in range(N):
    Ti,Xi,Yi = [int(x) for x in input().split()]
    if abs(Xi-X) + abs(Yi-Y) > (Ti-T):
        print('NO')
        break
    else:
        if Flag == 'Even':
            if (Ti-T) % 2 == 0:#Even and Even = Even
                if (Xi + Yi) % 2 == 0:
                    X = Xi
                    Y = Yi
                    T = Ti
                    continue
                else:
                    print('NO')
                    break
            else:#Even and Odd = Odd
                if (Xi + Yi) % 2 == 0:
                    print('NO')
                    break
                else:
                    X = Xi
                    Y = Yi
                    T = Ti
                    Flag = 'Odd'
                    continue
        else:#Odd
            if (Ti - T) % 2 == 0: #Odd and Even = Odd
                if(Xi + Yi)% 2 == 0:
                    print('No')
                    break
                else:
                    X = Xi
                    Y = Yi
                    T = Ti
                    continue
            else: #Odd and Odd = Even
                if(Xi + Yi) % 2 == 0:
                    X = Xi
                    Y = Yi
                    T = Ti
                    Flag = 'Even'
                    continue
                else:
                    print('NO')
                    break
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
import sys
import math
#データを取得
data = input().split()#lines[0]つまり１行目をスペースで区切る.dataは配列
N = int(data[0])
t = []#時間tを入れる配列,x,yについても同様
x = []
y = []
for i in range(N):			#配列に値を入れる
    data = input().split()
    t.append(int(data[0]))
    x.append(int(data[1]))
    y.append(int(data[2]))
 
 
for i in range(N):
    flag1 = False
    flag2 = False
    if t[i]%2 == 0 and (abs(x[i]) + abs(y[i]))%2 == 0:
        flag1 = True
    if t[i]%2 != 0 and (abs(x[i]) + abs(y[i]))%2 != 0:
        flag1 = True
    if math.sqrt(x[i]*x[i] + y[i]*y[i]) <= t[i]:
        flag2 = True
    if flag1 == False or flag2 == False:
        print('No')
        break
    
if flag1 == True and flag2 == True:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
#データを取得
data = input().split()#lines[0]つまり１行目をスペースで区切る.dataは配列
N = int(data[0])
t = []#時間tを入れる配列,x,yについても同様
x = []
y = []
for i in range(N):			#配列に値を入れる
    data = input().split()
    t.append(int(data[0]))
    x.append(int(data[1]))
    y.append(int(data[2]))
 
 
for i in range(N):
    flag1 = False
    flag2 = False
    if t[i]%2 == 0 and (abs(x[i]) + abs(y[i]))%2 == 0:
        flag1 = True
    if t[i]%2 != 0 and (abs(x[i]) + abs(y[i]))%2 != 0:
        flag1 = True
    if math.sqrt(x[i]*x[i] + y[i]*y[i]) < t[i]:
        flag2 = True
    if flag1 == False or flag2 == False:
        print('No')
        break
    
if flag1 == True and flag2 == True:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
#データを取得
data = input().split()#lines[0]つまり１行目をスペースで区切る.dataは配列
N = int(data[0])
t = []#時間tを入れる配列,x,yについても同様
x = []
y = []
for i in range(N):			#配列に値を入れる
    data = input().split()
    t.append(int(data[0]))
    x.append(int(data[1]))
    y.append(int(data[2]))


for i in range(N):
    flag1 = False
    flag2 = False
    if t[i]%2 == 0 and (abs(x[i]) + abs(y[i]))%2 == 0:
        flag1 = True
    if t[i]%2 != 0 and (abs(x[i]) + abs(y[i]))%2 != 0:
        flag1 = True
    if math.sqrt(x[i]*x[i] + y[i]*y[i]) <= t[i]:
        flag2 = True
    if flag1 == False or flag2 == False:
        print('No')
        break
    
if flag1 == True and flag2 == True:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys


# 最短で向かう、余ったら時間をつぶす
def is_possible(p_t, p_x, p_y, point):

    # まず最短で向かう
    while p_x != point[1]:
        if p_x < point[1]:
            p_x += 1
        if p_x > point[1]:
            p_x -= 1
        p_t +=1
        
    while p_y != point[2]:
        if p_y < point[2]:
            p_y += 1
        if p_y > point[2]:
            p_y -= 1
        p_t +=1

    # 時間が余ったら、暇をつぶす
    while p_t < point[0]:        
        if p_t % 2 == 0:
            p_x += 1
            p_t += 1
        else:
            p_x -= 1
            p_t += 1
            
    # pointに到着できたらTrue    
    if ((p_t == point[0]) &
        (p_x == point[1]) &
        (p_y == point[2])):
        return True
    else:
        return False

# main
size = int(input())
points = [0]*size
for i in range(0, size):
    points[i] = list(map(int, input().split()))
print(points)

p_t = 0
p_x = 0
p_y = 0

for p in points:
    if is_possible(p_t, p_x, p_y, p):
        continue
    else:
        print('No')
        sys.exit()

print('Yes')
sys.exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
t_0, x_0, y_0 = [int(txy) for txy in input().split()]

for n in range(N-1):
  t_1, x_1, y_1 = [int(txyz) for txyz in input().split()]
  d_01 = abs(x_1 - x_0) + abs(y_1 - y_0)
  dt = t_1 - t_0
  if dt < d_01:
    print("No")
    break
  else:
    t_d = dt - d_01
    if t_d % 2 == 0:
      t_0, x_0, y_0 = t_1, x_1, y_1
    else:
      print("No")
      break
else:
  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()) 
for i in range(n-1):
    z=abs(x[i]-x[i+1])+abs(y[i]-y[i+1])
    if(z<=t[i+1]-t[i] and (z-t[i+1]+t[i])%2==0):
        print("yes")
print("No")

Submission status: Wrong Answer

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

for i in range(N):
    dxdy = coo[i+1][0] - coo[i][0] + coo[i+1][1] - coo[i][1]
    rt = T[i+1] - T[i] % 2
    rdxdy = dxdy % 2
    if dxdy <= T[i+1] - T[i] and rt == rdxdy:
        pass
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

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

for i in range(N):
    dxdy = coo[i+1][0] - coo[i][0] + coo[i+1][1] - coo[i][1]
    if dxdy <= T[i+1] - T[i]:
        pass
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from sys import stdin
def main():
    n = int(input())
    px, py = 0, 0
    tmp = 0
    for i in range(n):
        t, x, y = map(int, stdin.readline().split())
        t -= tmp
        if t < abs(x-px)+abs(y-py):
            print("No")
            return 0
        elif (t > abs(x-px)+abs(y-py))and((t-abs(x-px)-abs(y-py))%2):
            print("No")
            return 0
        px, py = x, y
        tmp = t
    print("Yes")

if __name__=="__main__": main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
def main():
    n = int(input())
    px, py = 0, 0
    tmp = 0
    for i in range(n):
        t, x, y = map(int, stdin.readline().split())
        t -= tmp
        if t < abs(x-px)+abs(y-py):
            print("No")
            return 0
        elif (t > abs(x-px)+abs(y-py))and(t%2):
            print("No")
            return 0
        px, py = x, y
        tmp = t
    print("Yes")

if __name__=="__main__": main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
def main():
    n = int(input())
    px, py = 0, 0
    for i in range(n):
        t, x, y = map(int, stdin.readline().split())
        if t < abs(x-px)+abs(y-py):
            print("No")
            break
        elif (t != abs(x-px)+abs(y-py))and(t%2):
            print("No")
            break
        px, py = x, y
    else: print("Yes")

if __name__=="__main__": main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = 0 
y = 0
t = 0

for i in Input:
    dif_x = abs(x - i[1])
    dif_y = abs(y - i[2])
    dif_t = abs(t - i[0])

    if dif_x + dif_y <= dif_t and (dif_x + dif_y)%2 == dif_t%2:
        x = i[1]
        y = i[2]
        t = i[0]
    else:
        print("NO")
        break

else:
    print("YES")

Submission status: Wrong Answer

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

#位置、時間の初期値
x = 0
y = 0
t = 0

for i in Input:
    dif_x = abs(x - i[1])
    dif_y = abs(y - i[2])
    dif_t = abs(t - i[0])

    if dif_x + dif_y <= dif_t and (dif_x + dif_y)%2 == dif_t%2:
        x = i[1]
        y = i[2]
        t = i[0]
    else:
        print("NO")
        break

else:
    print("YES")

Submission status: Wrong Answer

Solution code:
n=int(input())

ans='Yes'
dt=0
cur=0
cur_t=0
dist=0
for i in range(n):
	t,x,y=map(int,input().split())
	dist=abs(cur-(x+y))
	cur=x+y
	dt=t-cur_t
	cur_t=t
	
	if dist>dt or dt%2==(dist)%2:continue
	else:
		ans='No'
		break
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

ans='Yes'
tmp=0
for i in range(n):
	t,x,y=map(int,input().split())
	tmp=t-tmp
	if x+y>tmp:
		ans='No'
		break
	if t%2==0 and (x+y)%2==0 or t%2==1 and (x+y)%2==1:continue
	else:
		ans='No'
		break
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

ans='No'
tmp=0
for i in range(n):
	t,x,y=map(int,input().split())
	tmp=t-tmp
	if x+y>tmp:break
	if t%2==0 and (x+y)%2==0 or t%2==1 and (x+y)%2==1:ans='Yes'
	else:break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

can = True

for n in range(len(input_lis)):
    dis = 0
    t = 0
    if n == 0:
        dis = abs(input_lis[n][1]) + abs(input_lis[n][2])
        t = abs(input_lis[n][0])
    else:
        dis = abs(input_lis[n][1] - input_lis[n-1][1]) + abs(input_lis[n][2] - input_lis[n-1][2])
        t = abs(input_lis[n][0]) - abs(input_lis[n-1][0])
    
    if dis == t:
        continue
    if dis < t and ((t - dis) % 2) == 0:
        continue
    can = False
    break

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

Submission status: Wrong Answer

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

can = True

for n in range(len(input_lis)):
    dis = 0
    t = 0
    if n == 0:
        dis = abs(input_lis[n][1]) + abs(input_lis[n][2])
        t = abs(input_lis[n][0])
    else:
        dis = abs(input_lis[n][1] - input_lis[n-1][1]) + abs(input_lis[n][2] - input_lis[n-1][2])
        t = abs(input_lis[n][0]) - abs(input_lis[n-1][0])
    
    if dis == t:
        continue
    if dis < t and ((t - dis) % 2) == 0:
        continue
    can = False
    break

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

Submission status: Wrong Answer

Solution code:
N=int(input())
t,x,y=0,0,0
s=0
for i in range(N):
  a,b,c=map(int,input().split())
  if a-t!=abs(b-x)+abs(c-y):
    s=1
    break
  t,x,y=a,b,c
print("No" if s else "Yes")

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    N = int(input()) + 1
    P = [list(map(int, input().split())) for x in range(N-1)]
    P.insert(0, [0,0,0])
    #print(N, P)
    for i in range(1, N):
        t = abs(P[i-1][0] - P[i][0])
        
        if t%2 == 0:
            if (abs( sum(P[i-1][1:]) - sum(P[i][1:]) ) <= t) and (abs( sum(P[i-1][1:]) - sum(P[i][1:]))) % 2 == 0:
                pass
            else:
                break
        
        else:
            if (abs( sum(P[i-1][1:]) - sum(P[i][1:]) ) <= t) and (abs( sum(P[i-1][1:]) - sum(P[i][1:]))) % 2 == 1:
                pass
            else:
                break
    else:
        print('OK')
        exit()
    print('NO')

Submission status: Wrong Answer

Solution code:
# -*- coding: UTF-8 -*-

N = int(input())
T = []
X =[]
Y=[]

for i in range(0,N):
    ti,xi,yi = map(int, input().split())
    T.append(ti)
    X.append(xi)
    Y.append(yi)

x=0
y=0


for i in range(0,N):
    if (x==X[i]+1 and y==Y[i]) or (x==X[i]-1 and y==Y[i]) or (x==X[i] and y==Y[i]+1) or (x==X[i] and y==Y[i]-1):
        x=X[i]
        y=Y[i]
    else:
        print("No")
        break
    if i==N-1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
# -*- coding: UTF-8 -*-

N = int(input())
T = []
X =[]
Y=[]

for i in range(0,N):
    ti,xi,yi = map(int, input().split())
    T.append(ti)
    X.append(xi)
    Y.append(yi)

x=0
y=0


for i in range(0,N):
    if (x==X[i]+1 and y==Y[i]) or (x==X[i]-1 and y==Y[i]) or (x==X[i] and y==Y[i]+1) or (x==X[i] and y==Y[i]-1):
        x=X[i]
        y=Y[i]
    else:
        print("No")
    if i==N-1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
# -*- coding: UTF-8 -*-

N = int(input())
T = []
X =[]
Y=[]

for i in range(0,N):
    ti,xi,yi = map(int, input().split())
    T.append(ti)
    X.append(xi)
    Y.append(yi)

x=0
y=0
print(T)
print(X)
print(Y)

for i in range(0,N):
    if (x==X[i]+1 and y==Y[i]) or (x==X[i]-1 and y==Y[i]) or (x==X[i] and y==Y[i]+1) or (x==X[i] and y==Y[i]-1):
        x=X[i]
        y=Y[i]
    else:
        print("No")
    if i==N-1:
        print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
x = []
y = []
t = []
distance = []
x.append(0)
y.append(0)
t.append(0)

for i in range(N):
    STR = input().split()
    t.append(int(STR[0]))
    x.append(int(STR[1]))
    y.append(int(STR[2]))

dis = 0
flag = True
for i in range(1,N+1):
    time = t[i] - t[i-1]
    dis = abs(x[i] -x[i-1])+abs(y[i] - y[i-1])
    print(time)
    print(dis)
    if time != dis :
        if time < dis:
            #print("time<dis")
            flag = False
        elif time - dis > 0 and (time-dis) %2 == 1:
            #print("time%2")
            flag = False

if flag:
    print("Yes")
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())
flg = True
for i in range(N-1):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if dt < dist:
        flg = False
    if dist % 2 != dt % 2:
        flg = False
if flg:
    print('Yes')
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())
flg = True
for i in range(N-1):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if dt < dist:
        flg = False
    if dist % 2 != dt % 2:
        flg = False
if flg:
    print('Yes')
if not flg:
    print('No')

Submission status: Wrong Answer

Solution code:
# 10
import sys
N = int(input())
for _ in range(N):
    t, x, y = map(int, input().split())
    if ((x + y) % 2) != (t % 2):
        print('NO')
        sys.exit()
    if t < x + y:
        print('NO')
        sys.exit()
print('YES')

Submission status: Wrong Answer

Solution code:
#! env python
# -*- coding: utf-8 -*-

import os
import sys

# at_coder.ABC086C_Traveling
# Date: 2019/06/02
# Filename: ABC086C_Traveling 

__author__ = 'acto_mini'
__date__ = "2019/06/02"


def main():
    # 作業ディレクトリを自身のファイルのディレクトリに変更
    os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))

    t, x, y = [0], [0], [0]

    # 整数の入力
    num = int(input())

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

    can = True
    for i in range(num):
        dt = t[i + 1] - t[i]
        dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
        if (dt < dist):
            can = False
        if (dt % 2 != dist % 2):
            can = False

    if can:
        print("YES")
    else:
        print("No")

    return


if __name__ == '__main__':
    main()