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:
from sys import stdin
data = stdin.readlines()

N = int(data[0])
l = [0, 0]
i = 1
while i <= N:
    l.append(int(data[i].split()[0]))
    l.append(int(data[i].split()[1])+int(data[i].split()[2]))
    i += 1

def check(x):
    diffrent_time = l[2*x] - l[2*x-2]
    diffrent_place = l[2*x+1] - l[2*x-1]
    return diffrent_time % 2 == diffrent_place % 2 and diffrent_time >= diffrent_place

count = 0
i = 1
while i <= N:
    if check(i) == False:
        count = 1
    i += 1
if count == 0:
    print("Yes")
elif count == 1:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

flag = 0
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 t[i] > x[i]+y[i]:
    flag += 1
  if t[i]%2 != (x[i]+y[i])%2:
    flag +=1
  if i > 1:
    if abs(t[i-1]-t[i]) > abs(x[i-1]+y[i-1])-abs(x[i]+y[i]):
      flag +=1

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

Submission status: Wrong Answer

Solution code:
n = int(input())

flag = 0

for i in range(n):
  t, x, y = map(int, input().split())
  
  if t > x+y:
    flag += 1
  if t%2 != (x+y)%2:
    flag +=1

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

Submission status: Wrong Answer

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

txy = list(zip(*txy))

t = list(txy[0])
if len(t) != len(list(set(t))):
    print("No")
    exit()

x = list(txy[1])
y = list(txy[2])
nowt = 0
nowx = 0
nowy = 0

for i in range(N):
    time = min(t)
    place = t.index(min(t))
    if time - nowt < abs(x[place]-nowx) + abs(y[place]-nowy):
        print("No")
        exit()
    elif ((time-nowt) - (abs(x[place]-nowx) + abs(y[place]-nowy)))%2 != 0:
        print("No")
        exit()
    else:
        nowt = time
        nowx = x[place]
        bowy = y[place]
        t[place] = 10**5 +1


print("Yes")

Submission status: Wrong Answer

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

txy = list(zip(*txy))

t = list(txy[0])
x = list(txy[1])
y = list(txy[2])
nowt = 0
nowx = 0
nowy = 0

for i in range(N):
    time = min(t)
    place = t.index(min(t))
    if time - nowt < abs(x[place]-nowx) + abs(y[place]-nowy):
        print("No")
        exit()
    elif ((time-nowt) - (abs(x[place]-nowx) + abs(y[place]-nowy)))%2 != 0:
        print("No")
        exit()
    else:
        nowt = time
        nowx = x[place]
        bowy = y[place]
        t[place] = 10**5 +1
        

print("Yes")

Submission status: Wrong Answer

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

txy = list(zip(*txy))

t = list(txy[0])
x = list(txy[1])
y = list(txy[2])
nowt = 0
nowx = 0
nowy = 0

for i in range(N):
    time = min(t)
    place = t.index(min(t))
    if time - nowt < abs(x[place]-nowx) + abs(y[place]-nowy):
        print("No")
        exit()
    elif ((time-nowt) - ((abs(x[place]-nowx) + abs(y[place]-nowy))))%2 != 0:
        print("No")
        exit()
    else:
        nowt = time
        nowx = x[place]
        bowy = y[place]
        del t[place]
        del x[place]
        del y[place]

print("Yes")

Submission status: Wrong Answer

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

txy = list(zip(*txy))

t = list(txy[0])
x = list(txy[1])
y = list(txy[2])
nowt = 0
nowx = 0
nowy = 0

for i in range(N):
    time = min(t)
    place = t.index(min(t))
    if time - nowt < abs(x[place]-nowx) + abs(y[place]-nowy):
        print("No")
        exit()
    elif ((time-nowt) - (abs(x[place]-nowx) + abs(y[place]-nowy)))%2 != 0:
        print("No")
        exit()
    else:
        nowt = time
        nowx = x[place]
        bowy = y[place]
        del t[place]
        del x[place]
        del y[place]

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
tm_pos = [list(map(int, input().split())) for i in range(N)]
for i in tm_pos:
    if i[0] < abs(i[1]) + abs(i[2]) or i[0] % 2 != (abs(i[1]) + abs(i[2])) % 2:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
tm_pos = [list(map(int, input().split())) for i in range(N)]
for i in tm_pos:
    if i[0] < i[1] + i[2] or i[0] % 2 != (i[1] + i[2]) % 2:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
plcs = [list(map(int,input().split())) for _ in range(n)]
A = [0, 0, 0]
for i in range(n):
    A = [plcs[i][j] - A[j] for j in range(3)]
    if A[0] >= A[1] + A[2] and A[0] % 2 == (abs(A[1]) + abs(A[2])) % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
plcs = [list(map(int,input().split())) for _ in range(n)]
A = [0, 0, 0]
for i in range(n):
    A = [plcs[i][j] - A[j] for j in range(3)]
    if A[0] >= A[1] + A[2] and A[0] % 2 == abs(A[1] + A[2]) % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
pre_t = 0
for i in range(n):
    t, x, y=map(int, input().split())
    if (x + y) > (t - pre_t) or (x + y + (t - pre_t)) % 2:
        print("No")
        exit()
    pre_t = t
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(1,n+1):
    t[i],x[i],y[i]=map(int, input().split())
    
for i in range(1,n+1):
    time=t[i]-t[i-1]
    trip=x[i]-x[i-1]+y[i]-y[i-1]
    if time<trip:
        print("No")
        exit()
    else:
        extra=time-trip
        if extra%2!=0:
            print("No")
            exit()

print("Yes")

Submission status: Wrong Answer

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

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())
	d_xy = abs(x - _x) + abs(y - _y)
	d_t = _t - t
	if d_xy <= d_t and d_xy%2 == d_t%2:
		pass
	else:
		print("No")
		exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
t=[0]
x = [0]
y = [0]

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

flag = True
for i in range(1,n+1):

    if (t[i]-t[i-1])%2 != (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2 or (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))>=t[i]-t[i-1]:
        flag = False


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

Submission status: Wrong Answer

Solution code:
N = int(input())

nx = 0
ny = 0
nt = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    k = abs(nx-x)+abs(ny-y)
    if k > t:
        print("No")
        break
    if (k-t)%2 != 0:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

nx = 0
ny = 0
nt = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    k = abs(nx-x)+abs(ny-y)
    if k > t:
        print("No")
        break
    if (k-t)%2 != 0:
        print("No")
        break
    nx = x
    ny = y
    nt = t
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
def main():
    n=int(input())
    nowx = 0
    nowy = 0
    is_ok = True
    for _ in range(n):
        t,x,y = map(int,input().split())
        if is_ok:
            d = abs(x-nowx) + abs(y-nowy)
            if t < d:
                is_ok = False
            elif (t - d) % 2 != 0:
                is_ok = False
    if is_ok:
        print("Yes")
    else:
        print("No")
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
apple = []
for _ in range(n):
    apple.append(list(map(int, input().split())))
count = 0
y = 1
t = 0
b1 = 0
b2 = 0
for a in range(n):
    if y == 1:
        i = apple[a]
        t = i[0]
        k = abs(i[1]) + abs(i[2])
        b1 = i[1]
        b2 = i[2]
        if k <= t:
            if k%2 == t%2:
                count += 1
            else:
                count = 0
                break
        else:
            count = 0
            break
    else:
        i = apple[a]
        t = i[0] - t
        t = i[0]
        k = abs(b1 - i[1]) + abs(b2 - i[2])
        b1 = i[1]
        b2 = i[2]
        if k <= t:
            if k%2 == t%2:
                count += 1
            else:
                count = 0
                break
        else:
            count = 0
            break
print("Yes" if count == n else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
apple = []
for _ in range(n):
    apple.append(list(map(int, input().split())))
count = 0
y = 1
t = 0
b1 = 0
b2 = 0
for a in range(n):
    if y == 1:
        i = apple[a]
        t = i[0]
        k = abs(i[1]) + abs(i[2])
        b1 = i[1]
        b2 = i[2]
        if k <= t:
            if k%2 == t%2:
                count += 1
            else:
                count = 0
                break
        else:
            count = 0
            break
    else:
        i = apple[a]
        t = i[0] - t
        k = abs(b1 - i[1]) + abs(b2 - i[2])
        b1 = i[1]
        b2 = i[2]
        if k <= t:
            if k%2 == t%2:
                count += 1
            else:
                count = 0
                break
        else:
            count = 0
            break
print("Yes" if count == n else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
apple = []
for _ in range(n):
    apple.append(list(map(int, input().split())))
a = [0, 0]
count = 0
for i in apple:
    t = i[0]
    b = i[1:]
    if abs(b[0]) + abs(b[1]) <= t:
        if (abs(b[0]) + abs(b[1]))%2 == t%2:
            count += 1
        else:
            count = 0
            break
    else:
        count = 0
        break
print("Yes" if count == n else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
apple = []
for _ in range(n):
    apple.append(list(map(int, input().split())))
a = [0, 0]
count = 0
for i in apple:
    t = i[0]
    b = i[1:]
    if sum(b) <= t:
        if sum(b)%2 == t%2:
            count += 1
        else:
            count = 0
            break
    else:
        count = 0
        break
print("Yes" if count == n else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
apple = []
for _ in range(n):
    apple.append(list(map(int, input().split())))
a = [0, 0]
count = 0
for i in apple:
    t = i[0]
    b = i[1:]
    if sum(b) <= t:
        if sum(b)%2 == t%2:
            count += 1
        else:
            count = 0
            break
    else:
        count = 0
        break
print("Yes" if count != 0 else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
apple = []
for _ in range(n):
    apple.append(list(map(int, input().split())))
a = [0, 0]
count = 0
for i in apple:
    t = i[0]
    b = i[1:]
    if sum(b) > t:
        count += 0
        break
    else:
        if sum(b)%2 == t%2:
            count += 1
        else:
            count += 0
            break
print("Yes" if count != 0 else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
t,x,y = 0,0,0
for i in range(n):
  nt, nx, ny  = map(int, input().split())
  if not(abs(nx-x)+abs(ny-y) <= nt-t and t%2 == (x+y)%2):
    print("No")
    exit()
  t,x,y = nt,ny,nx
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
t,x,y = 0,0,0
for i in range(n):
  nt, nx, ny  = map(int, input().split())
  if not(abs(nx-x)+abs(ny-y) <= nt-t and t%2 == (x+y)%2):
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
"""this is python work script"""

def check_distance(trip_records):
    answer = True
    present_location = {'x':0, 'y':0}

    for d, x, y in trip_records:
        x_distance = abs(present_location['x'] - x)
        y_distance = abs(present_location['y'] - y)
        distance = x_distance + y_distance

        if d < distance:
            answer = False

        present_location['x'] = x
        present_location['y'] = y

    return answer


def check_parity(trip_records):
    answer = True

    for d, x, y in trip_records:
        if d % 2 != (x + y) % 2:
            answer = False
    return answer

def solver(trip_records):
    """solve this problem"""

    parity_ok = check_parity(trip_records)
    distance_ok = check_distance(trip_records)

    answer = 'No'
    if parity_ok and distance_ok:
        answer = 'Yes'

    return answer

def main():
    """main function"""
    N = int(input())
    trip_records = [list(map(int, input().rstrip().split(' '))) for _ in range(N)]

    answer = solver(trip_records)
    print(answer)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

x_now, y_now, t_now = 0, 0, 0

for i in range(n):
    t, x, y = map(int, input().split())
    distance = (t -t_now) - abs(x-x_now) - abs(y-y_now)
    if distance > 0 and distance % 2 == 0:
        x_now,y_now,t_now = x,y,t
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

x_now, y_now, t_now = 0, 0, 0

for i in range(n):
    t, x, y = map(int, input().split())
    if ((t -t_now) - abs(x-x_now) - abs(y-y_now)) % 2 == 0 :
        x_now,y_now,t_now = x,y,t
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

def enable_move(old_pos, new_pos):
    old_t, old_x, old_y = old_pos
    new_t, new_x, new_y = new_pos
    t = new_t - old_t
    d = (new_x - old_x) + (new_y - old_y)
    if t < d:
        return False
    return ((t - d) % 2 == 0)

ans = "Yes"
old_pos = [0, 0, 0]
for _ in range(n):
    new_pos = [int(s) for s in input().split()]
    if not enable_move(old_pos, new_pos):
        ans = "No"
        break
    old_pos = new_pos
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N = I()
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(N):
    t, x, y = LI()
    if (x+y) > (t - prev_t) or (abs(prev_x-x) + abs(prev_y-y) + (t - prev_t)) % 2:
        print('No')
        exit()
    prev_t = t
    prev_x = x
    prev_y = y
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())

ts,xs,ys = 0,0,0

for i in range(N):
    t,x,y = map(int,input().split())
    if x-xs + y-ys > t-ts:
        print("No")
        break
    else:
        if (x-xs + y-ys - t-ts) % 2 != 0:
            print("No")
            break
        else:
            ts,xs,ys = t,x,y
    
if ts == t:
    print("Yes")

Submission status: Wrong Answer

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

for j in range(hoge):
    if j == 0:
        if (cite[j][1] + cite[j][2]) > cite[j][0] or (cite[j][1] + cite[j][2])% 2 != cite[j][0]%2:
            print("No")
            break
        elif j == hoge-1:
            print("Yes")
            break

    else:
        if (cite[j][1]-cite[j-1][1]+cite[j][2]-cite[j-1][2]) > (cite[j][0]-cite[j-1][0]) or (cite[j][1]-cite[j-1][1]+cite[j][2]-cite[j-1][2]) % 2 != (cite[j][0] - cite[j - 1][0]) % 2:
            print("No")
            break
        elif j == hoge-1:
            print("Yes")
            break

Submission status: Wrong Answer

Solution code:
n = int(input())

x0, y0 = 0, 0

for _ in range(n):
  t, x, y = map(int, input().split())
  if abs(x-x0) + abs(y-y0) > t or (x+y)%2 != t%2:
    status = "No"
    break
  else:
    status = "Yes"
    x0, y0 = x, y
    
print(status)

Submission status: Wrong Answer

Solution code:
n = int(input())

for _ in range(n):
  t, x, y = map(int, input().split())
  if x + y > t:
    status = "No"
    break
  elif (x+y)%2 != t%2:
    status = "No"
    break
  else:
    status = "Yes"
    
print(status)

Submission status: Wrong Answer

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

for i in range(n):
  if txy[i][1] + txy[i][2] > txy[i][0]:
    status = "No"
    break
  elif (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
    status = "No"
    break
  else:
    status = "Yes"
    
print(status)

Submission status: Wrong Answer

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

for i in range(n):
  if txy[i][1] + txy[i][2] >txy[i][0]:
    status = "No"
    break
  elif (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
    status = "No"
    break
  else:
    status = "Yes"
    
print(status)

Submission status: Wrong Answer

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

for i in range(n):
  if txy[i][1] + txy[i][2] >txy[i][0]:
    status = "No"
    break
  elif (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
    status = "No"
    break
  else:
    status = "Yes"
    
print(status)

Submission status: Wrong Answer

Solution code:
N = int(input())
X = list([int(j) for j in input().split()] for i in range(N))
X.insert(0, [0, 0, 0])

c = 0  

while c <= N-1:
  R = (X[c+1][0]-X[c][0])-(X[c+1][1]+X[c+1][2]-X[c][1]-X[c][2])
  if R<0 or R%2 != 0:
    print("No")
    break
  c += 1
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
pre_t,pre_x,pre_y=0,0,0
reachable=True
for _ in range(N):
  t,x,y=map(int,input().split())
  dist=abs(x-pre_x)+abs(y-pre_y)
  time=t-pre_t
  if dist<=time:
    if dist%2==time%2:
      pass
    else:
      reachable=False
      break
  else:
    reachable=False
    break
  pass
if reachable:print('Yes')
else: print('No')

Submission status: Wrong Answer

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

for j in range(rows):
    if x[j][0] >= abs(x[j][1]) + abs(x[j][2]):
        if x[j][0] % 2 == (abs(x[j][1]) + abs(x[j][2])) % 2:
            pass
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
st = 0
sx = 0
sy = 0
flg = False
for _ in range(N):
    t,x,y = map(int,input().split())

    if (x+y)-(sx+sy) > (t-st) or (t-st) % 2 != ((x+y)-(sx+sy)) % 2:
        flg = True
        break
    else:
        st = t
        sx = x
        sy = y
print('No' if flg else 'Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())

for _ in range(N):
    t,x,y = map(int,input().split())
    if x+y > t or t % 2 != (x+y) % 2:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
st = 0
sx, sy = 0, 0
ng = False
for _ in range(n):
    t, x, y = map(int, input().split())
    dt = (t - st)
    dx = abs(sx - x)
    dy = abs(sy - y)

    if dt%2 == (dx+dy)%2 and dx+dy <= dt:
        continue
    else:
        ng = True
        break
print('No' if ng else 'Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t0 = 0
x0 = 0
y0 = 0
flag = True

for _ in range(n):
    t, x, y = map(int, input().split())
    t -= t0
    x -= x0
    y -= y0
    diff = abs(x) + abs(y)
    if diff > t:
        flag = False
        break
    if t % 2:
        if diff % 2:
            pass
        else:
            flag = False
            break
    else:
        if diff % 2:
            flag = False
            break
        else:
            pass
print('Yes') if flag else print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
cnt = 0
sum = 0
flag = 0
for i in range(N):
    if i == 0:
        cnt = x[i][0]
        sum = x[i][1]
    else:
        cnt = x[i][0] - x[i-1][0]
        sum = abs(x[i][1]-x[i-1][1]) + abs(x[i][2]-x[i-1][2])
    if cnt < sum:
        flag = 1
    if cnt % 2 != sum % 2:
        flag = 1
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
cnt = 0
sum = 0
flag = 0
for i in range(N):
    if i == 0:
        cnt = x[i][0]
        sum = x[i][1]
    else:
        cnt = x[i][0] - x[i-1][0]
        sum = abs(x[i][1]-x[i-1][1]) + abs(x[i][2]-x[i-1][2])
    if cnt < sum or cnt % 2 != sum % 2:
        flag = 1
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
cnt = 0
sum = 0
flag = 0
for i in range(N):
    if i == 0:
        cnt = x[i][0]
        sum = x[i][1]
    else:
        cnt = x[i][0] - x[i-1][0]
        sum = abs(x[i][1]-x[i-1][1]) + abs(x[i][2]-x[i-1][2])
    if cnt < sum or cnt % 2 != sum % 2:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
cnt = 0
sum = 0
flag = 0
for i in range(N):
    if i == 0:
        cnt = x[i][0]
        sum = x[i][1]
    else:
        cnt = x[i][0] - x[i-1][0]
        sum = abs(x[i][1]-x[i-1][1]) + abs(x[i][2]-x[i-1][2])
    if cnt >= sum and cnt % 2 == sum % 2:
        flag = 0
    else:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
cnt = 0
sum = 0
flag = 0
for i in range(N):
    if i == 0:
        cnt = x[i][0]
        sum = x[i][1]
    else:
        cnt = x[i][0] - x[i-1][0]
        sum = abs(x[i][1]+x[i][2] - x[i-1][1]+x[i-1][2])
    if cnt >= sum and cnt % 2 == sum % 2:
        flag = 0
    else:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
cnt = 0
sum = 0
flag = 0
for i in range(N):
    if i == 0:
        cnt = x[i][0]
        sum = x[i][1]
    else:
        cnt = x[i][0] - x[i-1][0]
        sum = x[i][1]+x[i][2] - x[i-1][1]+x[i-1][2]
    if cnt >= sum and cnt % 2 == sum % 2:
        flag = 0
    else:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(readline().rstrip())
pos = (0, 0)
used_time = 0
for _ in range(N):
    t, x, y = map(int, readline().split())
    cost = abs(pos[0] - x) + abs(pos[1] - y)
    available = t - used_time
    # print("cost: {}".format(cost))
    # print("available: {}".format(available))
    if cost > available or ((cost - available) % 2 != 0):
        print('No')
        quit()
    used_time += t
    pos = (x, y)
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(readline().rstrip())
pos = (0, 0)
used_time = 0
for _ in range(N):
    t, x, y = map(int, readline().split())
    cost = abs(pos[0] - x) + abs(pos[1] - y)
    available = t - used_time
    # print("cost: {}".format(cost))
    # print("available: {}".format(available))
    if cost > available or (cost - available) % 2 != 0:
        print('No')
        quit()
    used_time += t
    pos = (x, y)
print('Yes')

Submission status: Wrong Answer

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

# 初期値
t = x = y = 0
# 判定フラグ
flag = 0
for l in coord:
    dt, dx, dy = l[0] - t, l[1] - x, l[2] - y
    # dtが以前のdx, dyの合計値よりも小さいならば不可
    if dt < dx + dy:
        flag = 1
        break
    else:
        # dtの偶奇とdx, dyの和の偶奇は等しくなるはず
        # 等しくない場合
        if dt % 2 != (dx + dy) % 2:
            flag = 1
            break
        else:
            t, x, y = l[0], l[1], l[2]
            continue

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

Submission status: Wrong Answer

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

# 初期値
t = x = y = 0
# 判定フラグ
flag = 0
for l in coord:
    dt, dx, dy = l[0] - t, l[1] - x, l[2] - y
    # dtが以前のdx, dyの合計値よりも小さいならば不可
    if dt < dx + dy:
        flag = 1
        break
    else:
        # dtの偶奇とdx, dyの和の偶奇は等しくなるはず
        # 等しくない場合
        if dt % 2 != (dx + dy) % 2:
            flag = 1
            break
        else:
            continue

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

Submission status: Wrong Answer

Solution code:
import sys
import math

def main():
    t = 0
    pos = 0, 0

    N = int(input())
    for i in range(N):
        ti, xi, yi = [int(v) for v in input().split()]

        dx = xi - pos[0]
        dy = yi - pos[1]

        td = ti - t
        dd = abs(dx + dy)
        
        if dd > td:
            print("No")
            sys.exit()
        
        if td % 2 != dd % 2:
            print("No")
            sys.exit()

    print("Yes")





if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    t = 0
    pos = 0, 0

    N = int(input())
    for i in range(N):
        ti, xi, yi = [int(v) for v in input().split()]
        # print("t", t)
        # print("pos", pos)
        # print("ti", ti)
        # print("xi, yi", xi, yi)

        dx = xi - pos[0]
        dy = yi - pos[1]

        if dx + dy > ti - t:
            print("No")
            sys.exit()

        ok = False

        while not ok:
            if dx + dy == ti - t:
                t = ti
                pos = xi, yi
                break
            
            if t > ti:
                print("No")
                sys.exit()
            
            t += 2

    print("Yes")





if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    t = 0
    pos = 0, 0

    N = int(input())
    for i in range(N):
        ti, xi, yi = [int(v) for v in input().split()]
        print("t", t)
        print("pos", pos)
        print("ti", ti)
        print("xi, yi", xi, yi)

        dx = xi - pos[0]
        dy = yi - pos[1]

        if dx + dy > ti - t:
            print("No")
            sys.exit()

        ok = False

        while not ok:
            if dx + dy == ti - t:
                t = ti
                pos = xi, yi
                break
            
            if t > ti:
                print("No")
                sys.exit()
            
            t += 2

    print("Yes")





if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

# def check(t, pos, ti, xi, yi):
#     dx = xi - pos[0]
#     dy = yi - pos[1]

#     if dx + dy == ti - t:
#         return ti, (xi, yi)
    
#     return check(t + 2, pos, ti, xi, yi)


def main():
    t = 0
    pos = 0, 0

    N = int(input())
    for i in range(N):
        ti, xi, yi = [int(v) for v in input().split()]

        dx = xi - pos[0]
        dy = yi - pos[1]

        if dx + dy > ti - t:
            print("No")
            sys.exit()

        ok = False

        while not ok:
            if dx + dy == ti - t:
                t = ti
                pos = xi, yi
                ok = True
            
            if t > ti:
                print("No")
                sys.exit()
            
            t += 2

    print("Yes")





if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
nowt = 0
nowx = 0
nowy = 0
for i in range(N):
  t, x, y = map(int, input().split())
  ti = t - nowt
  xi = x - nowx
  yi = y - nowy
  if ti < abs(xi) + abs(yi):
    print('No')
    exit()
  if ti%2 != (xi+yi)%2:
    print('No')
    exit()
    
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
t0=0
x0=0
y0=0
def num_abs(num):
    return abs(num)
ans=0
for i in range(n):
    t,x,y=map(int,input().split())
    numx=num_abs(x-x0)
    numy=num_abs(y-y0)
    if numx+numy>t or (t-(numx+numy))%2==1:
        ans=1
        break
if ans==1:
    print("No")
else:
    print("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:
        d = abs(pre_x - x) + abs(pre_y - y)
        if t - pre_t >= d and (t - pre_t) % 2 == d % 2:
            continue
        else:
            print('No')
            break
        pre_x = x
        pre_y = y
        pre_t = t
    else:
        print('Yes')
        
        
if __name__ == '__main__':
    main()