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())
for i in range(n):
    t,x,y = map(int, input().split())
    if x+y>t or (x+y+t)%2 :
    	print("No")
    	break
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
    ti, xi, yi = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
for i in range(1, N + 1):
    if abs(t[i - 1] - t[i]) < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        print("No")
        exit()
    if (abs(t[i - 1] - t[i]) - (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])) % 2) == 1:
        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):
    ti, xi, yi = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
for i in range(1, N + 1):
    if abs(t[i - 1] - t[i]) < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())

l=[list(map(int,input().split())) for i in range(n)]
l.insert(0,[0,0,0])
for i in range(n):
  t=l[i+1][0]-l[i][0]
  x=l[i+1][1]-l[i][1]
  y=l[i+1][2]-l[i][2]

  if t >=abs(x+y):
    if t%2 == (x+y)%2:
      continue
  else:
    break
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
tt,xx,yy=0,0,0
ans=0
for i in range(n):
  t,x,y=map(int,input().split())
  if (x-xx+y-yy)%2>0:
    ans=1
  if x-xx+y-yy>t-tt:
    ans=1
  tt,xx,yy=t,x,y
print("YNeos"[ans::2])

Submission status: Wrong Answer

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

bool = True
for i in range(N):
    d_t = abs(t[i+1]-t[i])
    d_xy = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    if d_t < d_xy:
        if (d_t - d_xy) % 2 == 1:
            bool = False

if bool == True:
    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):
    a = input().split()
    t.append(int(a[0]))
    x.append(int(a[1]))
    y.append(int(a[2]))

bool = False
for i in range(N):
    d_t = abs(t[i+1]-t[i])
    d_xy = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    if d_t >= d_xy:
        if (d_t - d_xy) % 2 == 0:
            bool = True

if bool == True:
    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):
    a = input().split()
    t.append(int(a[0]))
    x.append(int(a[1]))
    y.append(int(a[2]))

bool = False
for i in range(N):
    d_t = abs(t[i+1]-t[i])
    d_xy = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    if d_t >= d_xy:
        if d_t % 2 == d_xy % 2:
            bool = True

if bool == True:
    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):
    a = input().split()
    t.append(int(a[0]))
    x.append(int(a[1]))
    y.append(int(a[2]))

bool = False
for i in range(N):
    if t[i+1]-t[i] >= abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]):
        t_EO = (t[i+1]-t[i]) % 2
        xy_EO = (abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])) % 2
        if t_EO == xy_EO:
            bool = True

if bool == True:
    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):
    a = input().split()
    t.append(int(a[0]))
    x.append(int(a[1]))
    y.append(int(a[2]))

bool = False
for i in range(N):
    if t[i+1]-t[i] >= abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]):
        t_EO = (t[i+1]-t[i]) % 2
        xy_EO = (abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])) % 2
        if t_EO == xy_EO:
            bool = True

if bool == True:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(N):
  t[i+1], x[i+1], y[i+1] = map(int, input().split())
is_able = True
 
for i in range(N):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if dt < dist:
    is_able = False
  if dt % 2 != dist % 2:
    is_able = False
  
if is_able:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input())

grid = [[0,0,0]]

for i in range(N):
  array = list(map(int, input().strip().split()))
  grid.append(array)
    
for h in range(N):
  bool = False
  t = 0
  x = 0
  y = 0
  t = grid[h+1][0] - grid[h][0]
  x = grid[h+1][1] - grid[h][1]
  y = grid[h+1][2] - grid[h][2]
  
  if grid[h+1][0] < 0 or grid[h+1][1] < 0 or grid[h+1][2] <0:
    break 

  if (t - x - y) % 2 == 0 and t >= x + y:
    bool = True
  
if bool:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

grid = [[0,0,0]]

for i in range(N):
  array = list(map(int, input().strip().split()))
  grid.append(array)
    
for h in range(N):
  bool = False
  t = 0
  x = 0
  y = 0
  t = grid[h+1][0] - grid[h][0]
  x = grid[h+1][1] - grid[h][1]
  y = grid[h+1][2] - grid[h][2]
  

  if (t - x - y) % 2 == 0 and t >= x + y:
    bool = True
  
if bool:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

grid = [[0,0,0]]

for i in range(N):
  array = list(map(int, input().strip().split()))
  grid.append(array)
    
for h in range(N):
  bool = False
  t = 0
  x = 0
  y = 0
  t = grid[h+1][0] - grid[h][0]
  x = grid[h+1][1] - grid[h][1]
  y = grid[h+1][2] - grid[h][2]
  

  if (t - x - y) % 2 == 0 and t >= x + y:
    bool = True
  
if bool:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input())

grid = [[0,0,0]]

for i in range(N):
  array = list(map(int, input().strip().split()))
  grid.append(array)
    
for h in range(N):
  bool = False
  t = 0
  x = 0
  y = 0
  t = grid[h+1][0] - grid[h][0]
  x = grid[h+1][1] - grid[h][1]
  y = grid[h+1][2] - grid[h][2]
  
  print(t,x,y)
  
  if (t - x - y) % 2 == 0 and t >= x + y:
    bool = True
  
if bool:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
t=[list(map(int,raw_input().split())) for i in range(n)]
flag=False
if n==1:
	if (t[0][1]+t[0][2])%2==t[0][0]%2 or t[0][0]<t[0][1]+t[0][2]:
		flag=True
else:
	for i in range(n-1):
		dt=t[i+1][0]-t[i][0]
		dx=t[i+1][1]-t[i][1]
		dy=t[i+1][2]-t[i][2]
		if (dx+dy)%2!=dt%2 or dt<dx+dy:
			flag=True
			break

print "YNeos"[flag::2]

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
t=[list(map(int,raw_input().split())) for i in range(n)]
flag=False
if n==1:
	if (t[0][1]+t[0][2])%2==t[0][0] or t[0][0]<t[0][1]+t[0][2]:
		flag=True
else:
	for i in range(n-1):
		dt=t[i+1][0]-t[i][0]
		dx=t[i+1][1]-t[i][1]
		dy=t[i+1][2]-t[i][2]
		if (dx+dy)%2!=dt%2 or dt<dx+dy:
			flag=True
			break

print "YNeos"[flag::2]

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
judge = 'YES'

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

for i in range(1, N+1):
    if t[i]-t[i-1] < abs(x[i]-x[i-1]) + abs(y[i]-y[i-1]):
        judge = 'NO'
        break
    elif (t[i]-t[i-1]) % 2 != (abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])) % 2:
        judge = 'NO'
        break

print(judge)

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):
    if t[i]-t[i-1] < abs(x[i]-x[i-1]) + abs(y[i]-y[i-1]):
        print('NO')
        exit()
    elif (t[i]-t[i-1]) % 2 != (abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])) % 2:
        print('NO')
        exit()

print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
nl = set(range(n))
txy = [[0, 0, 0]]
ans = 'Yes'
for i in nl:
    txy.append(list(map(int, input().split())))
    tmp = [txy[i+1][k] - txy[i][k] for k in range(3)]
    time_diff = tmp[0]
    time_even_odd = 'Even' if time_diff % 2 == 0 else 'Odd'
    distance_diff = abs(tmp[1]) + abs(tmp[2])
    distance_even_odd = 'Even' if distance_diff % 2 == 0 else 'Odd'
    if (time_diff < distance_diff) and (distance_even_odd != time_even_odd):
        ans = 'No'
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
nl = set(range(n))
txy = [[0, 0, 0]]
ans = 'Yes'
for i in nl:
    txy.append(list(map(int, input().split())))
    tmp = [txy[i+1][k] - txy[i][k] for k in range(3)]
    time_diff = tmp[0]
    distance_diff = abs(tmp[1]) + abs(tmp[2])
    if (time_diff < 0) and (distance_diff % time_diff != 0):
        ans = 'No'
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = {}
for i in range(N):
    t, x, y = list(map(int, input().split(' ')))
    txy[t] = [x, y]

src_t = 0
src_x = 0
src_y = 0

success = True

for t, xy in txy.items():
    dest_t = t
    dest_x = xy[0]
    dest_y = xy[1]

    dt = dest_t - src_t
    if abs(dest_x - src_x) + abs(dest_y - src_y) > dt:
        success = False
        break
    else:
        if dt % 2 == (abs(dest_x - src_x) + abs(dest_y - src_y)) % 2:
            src_t = dest_t
            src_x = dest_x
            src_y = dest_y
            continue
        else:
            success = False
            break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = {}
for i in range(N):
    t, x, y = list(map(int, input().split(' ')))
    txy[t] = [x, y]

src_t = 0
src_x = 0
src_y = 0

success = True

for t, xy in txy.items():
    dest_t = t
    dest_x = xy[0]
    dest_y = xy[1]

    dt = dest_t - src_t
    if abs(dest_x - src_x) + abs(dest_y - src_y) <= dt:
        if dt % 2 == (abs(dest_x - src_x) + abs(dest_y - src_y)) % 2:
            src_t = dest_t
            src_x = dest_x
            src_y = dest_y
            continue
    
    success = False
    break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = {}
for i in range(N):
    t, x, y = list(map(int, input().split(' ')))
    txy[t] = [x, y]

src_t = 0
src_x = 0
src_y = 0

success = True

for t, xy in txy.items():
    dest_t = t
    dest_x = xy[0]
    dest_y = xy[1]

    dt = dest_t - src_t
    if abs(dest_x - src_x) + abs(dest_y - src_y) <= dt:
        if dt % 2 == (abs(dest_x - src_x) + abs(dest_y - src_y)) % 2:
            src_t = dest_t
            src_x = dest_x
            src_y = dest_y
            continue
    
    success = False

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

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = {}
for i in range(N):
    t, x, y = list(map(int, input().split(' ')))
    txy[t] = [x, y]

src_t = 0
src_x = 0
src_y = 0

success = True

for t, xy in txy.items():
    dest_t = t
    dest_x = xy[0]
    dest_y = xy[1]

    dt = dest_t - src_t
    if abs(dest_x - src_x) + abs(dest_y - src_y) <= dt:
        if dt % 2 == (abs(dest_x - src_x) + abs(dest_y - src_y)) % 2:
            src_t = dest_t
            src_x = dest_x
            src_y = dest_y
            continue
    
    success == False

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

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = {}
for i in range(N):
    t, x, y = list(map(int, input().split(' ')))
    txy[t] = [x, y]

src_t = 0
src_x = 0
src_y = 0

success = True

for t, xy in txy.items():
    dest_t = t
    dest_x = xy[0]
    dest_y = xy[1]

    dt = dest_t - src_t
    if abs(dest_x - src_x) + abs(dest_y - src_y) <= dt:
        if dt % 2 == abs(dest_x - src_x) + abs(dest_y - src_y) % 2:
            src_t = dest_t
            src_x = dest_x
            src_y = dest_y
            continue
    
    success == False

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

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = {}
for i in range(N):
    t, x, y = list(map(int, input().split(' ')))
    txy[t] = [x, y]

src_t = 0
src_x = 0
src_y = 0

success = True

for t, xy in txy.items():
    dest_t = t
    dest_x = xy[0]
    dest_y = xy[1]

    dt = dest_t - src_t
    if abs(dest_x - src_x) + abs(dest_y - src_y) <= dt:
        if t % 2 == abs(dest_x - src_x) + abs(dest_y - src_y) % 2:
            src_t = dest_t
            src_x = dest_x
            src_y = dest_y
            continue
    
    success == False

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

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [[int(0)] * 3]
txy += ([list(map(int, input().split())) for i in range(n)])

for i in range(n):
    t_diff = txy[i+1][0] - txy[i][0]
    xy_diff = (txy[i+1][1] + txy[i+1][2]) - (txy[i][1] + txy[i][2])

    if t_diff % 2 != xy_diff % 2 or xy_diff > t_diff:
        print("NO")
        exit()

print("YES")

Submission status: Wrong Answer

Solution code:
n = int(input())
T = [0] + [None] * n
X = [0] + [None] * n
Y = [0] + [None] * n
for i in range(1, n + 1):
  T[i], X[i], Y[i] = map(int, input().split())

for i in range(len(T) - 1):
  dt = T[i + 1] - T[i]
  dx = abs(X[i + 1] - X[i])
  dy = abs(Y[i + 1] - Y[i])
  if (dt % 2 != (dx + dy) % 2 and (dx + dy) > dt):
    print('No')
    exit()

print('Yes')

Submission status: Wrong Answer

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

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

f = True

for i in range(0, n):
    d = (p[i + 1][0] - p[i][0]) - (abs(p[i][1] - p[i + 1][1]) + abs(p[i][2] - p[i + 1][2]))
    if  d <= 0:
        f = False
        break
    else:
        if d % 2 == 1:
            f = False
            break

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

Submission status: Wrong Answer

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

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

f = True

for i in range(0, n):
    d = (p[i + 1][0] - p[i][0]) - (abs(p[i][1] - p[i + 1][1]) + abs(p[i][2] - p[i + 1][2]))
    print(d)
    if  d <= 0:
        f = False
        break
    else:
        if d % 2 == 1:
            f = False
            break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
z_t = []*N
t0 = 0
x0 = 0
y0 = 0
ans = 'NO'
for i in range(N):
    s = input().rstrip().split()
    z_t.append(s)

for i in range(N):
    dt = int(z_t[i][0]) - t0
    dx = abs(int(z_t[i][1]) - x0)
    dy = abs(int(z_t[i][2]) - y0)
    extra_t = dt - (dx+dy)
    if extra_t >=  0 and extra_t%2 == 0:
        t0 = int(z_t[i][0])
        x0 = int(z_t[i][1])
        y0 = int(z_t[i][2])
        if i == N-1:
            ans = 'YES'
    else:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
z_t = []*N
t0 = 0
x0 = 0
y0 = 0
ans = 'NO'
for i in range(N):
    s = input().rstrip().split()
    z_t.append(s)
print(z_t)

for i in range(N):
    dt = int(z_t[i][0]) - t0
    dx = abs(int(z_t[i][1]) - x0)
    dy = abs(int(z_t[i][2]) - y0)
    extra_t = dt - (dx+dy)

    if extra_t >=  0 and extra_t%2 == 0:
        t0 = int(z_t[i][0])
        x0 = int(z_t[i][1])
        y0 = int(z_t[i][2])
        if i == N-1:
            ans = 'YES'
    else:
        break


print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
z_t = []*N
t0 = 0
x0 = 0
y0 = 0
ans = 'NO'
for i in range(N):
    s = input().rstrip().split()
    z_t.append(s)
print(z_t)

for i in range(N):
    dt = int(z_t[i][0]) - t0
    dx = int(z_t[i][1]) - x0
    dy = int(z_t[i][2]) - y0
    extra_t = dt - (dx+dy)

    if extra_t >=  0 and extra_t%2 == 0:
        t0 = int(z_t[i][0])
        x0 = int(z_t[i][1])
        y0 = int(z_t[i][2])
        if i == N-1:
            ans = 'YES'
    else:
        break


print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
txy=[[int(i) for i in input().split()] for _ in range(n)]
ans='No'
if txy[0][1]+txy[0][2]<=txy[0][0]:
    for i in range(0,n-1):
        if abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])<=txy[i+1][0]-txy[i][0]:
            if (abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2]))%2==(txy[i+1][0]-txy[i][0])%2:
                ans='Yes'
        else:
            ans='No'
            break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [None] * N
X = [None] * N
Y = [None] * N

for i in range(N):
    T[i], X[i], Y[i] = map(int, input().split())

def is_reachable(t, x, y):
    x, y = abs(x), abs(y)
    if t >= (x + y):
        if (t - x - y) % 2 == 0:
            return True
    return False

ans = 'Yes'

if is_reachable(T[0], X[0], Y[0]):
    for i in range(N-1):
        t, x, y = T[i+1], X[i+1], Y[i+1]
        t, x, y = t - T[i], x - X[i], y - Y[i]
        if not is_reachable(t, x, y):
            ans = 'No'
            break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [None] * N
X = [None] * N
Y = [None] * N

for i in range(N):
    T[i], X[i], Y[i] = map(int, input().split())

def is_reachable(t, x, y):
    if t >= (x + y):
        if (t - x - y) % 2 == 0:
            return True
    return False

ans = 'Yes'

if is_reachable(T[0], X[0], Y[0]):
    for i in range(N-1):
        t, x, y = T[i+1], X[i+1], Y[i+1]
        t, x, y = t - T[i], x - X[i], y - Y[i]
        if not is_reachable(t, x, y):
            ans = 'No'
            break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [None] * N
X = [None] * N
Y = [None] * N

for i in range(N):
    T[i], X[i], Y[i] = map(int, input().split())

def is_enable(t, x, y):
    if t >= (x + y):
        if (t - x - y) % 2 == 0:
            return True
    return False

ans = 'Yes'

for i in range(N):
    t, x, y = T[i], X[i], Y[i]
    if i == 0:
        if not is_enable(t, x, y):
            ans = 'No'
            break
        continue
    t, x, y = t - T[i-1], x - X[i-i], y - Y[i-1]
    if not is_enable(t, x, y):
        ans = 'No'
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
x,y = 0, 0
tf = 0
hantei = False
for i in range(n):
    t,a,b = list(map(int, input().split()))
    t = t - tf
    if (abs(a - x) + abs(b - y)) > t:
        hantei = False
        break
    else:
        if (((abs(a - x) + abs(b - y)) % 2 ) == t % 2 ):
            hantei = True
            #print('A')
        else:
            hantei = False
            #print('B')
    tf = t
    x, y = a, b
if hantei:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N = I()
txy = []
for i in range(N):
    txy.append(LI())

txy = sorted(txy, key=lambda x:x[0])
#  print(txy)
count = 0
current = [0,0]
for item in txy:
    dist = abs(current[0] - item[1]) + abs(current[1] - item[2])
    if dist > item[0] - count:
        # 足らず
        print('No')
        exit()
    elif dist == item[0] - count:
        # ちょうど
        count = item[0]
    else:
        # 余り
        count = item[0]
        item[0] -= dist
        if item[0] % 2 != 0:
            # いけない
            print('No')
            exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(range(n))
for i in range(n):
    a[i] = list(map(int, input().split()))
dx = 0
dy = 0
for s in range(n):
    dx = abs(a[s][1] - dx)
    dy = abs(a[s][2] - dy)
    if((dx+dy)>a[s][0]):
        print("NO")
        break
    if(((dx+dy)%2) == (a[s][0]%2)):
        print("YES")
        break
    else:
        print("NO")
        break

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
T = [[0 for i in range(3)] for i in range(N+1)]
for i in range(1,N+1):
  input_lines = input().split()
  T[i][0] = int(input_lines[0])
  T[i][1] = int(input_lines[1])
  T[i][2] = int(input_lines[2])
T[0][0] = 0
T[0][1] = 0
T[0][2] = 0

for i in range(1,N+1):
  t = T[i][0] - T[i-1][0]
  d = abs(T[i][1] - T[i-1][1]) + abs(T[i][2] - T[i-1][2])
  if (t-d)%2 !=0:
    print("No")
    break
  if i == N:
    print("Yes")

Submission status: Wrong Answer

Solution code:
time,posix,posiy = 0,0,0

N = int(input())

for i in range(N):
  t,x,y = map(int,input().split())
  
  time = t - time
  deferr = int(abs(x - posix)) + int(abs(y - posiy))
  #print(time)
  #print(deferr)
  if deferr <= time and (deferr % 2) == (time % 2):
    posix = x
    posiy = y
    if N-1 == i:
      print("Yes")
      
  else:
    if N-1 == i:
      print("No")

Submission status: Wrong Answer

Solution code:
time,posix,posiy = 0,0,0

N = int(input())

for i in range(N):
  t,x,y = map(int,input().split())
  
  time = t - time
  deferr = int(abs(x - posix)) + int(abs(y - posiy))
  #print(time)
  #print(deferr)
  if deferr <= time and (deferr % 2) == (time % 2):
    posix = x
    posiy = y
    if N-1 == i:
      print("Yes")
      
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
# 0位置からの計算でも途中位置からの計算でも計算コストは同じ
def travelable(t, x, y):
    min_step = x + y
    if t < min_step:
        return False
    return (t - min_step) % 2 == 0


N = int(input())
for _ in range(N):
    t_x_y = list(map(int, input().split()))
    if not travelable(t_x_y[0], t_x_y[1], t_x_y[2]):
        print("No")
        break
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]
p = [0, 0]
failed = False
t = 0
for i in range(N):
    t = txy[i][0] - t
    x, y = txy[i][1:]
    dx, dy = abs(x-p[0]), abs(y-p[1])
    if t < dx+dy:
        failed = True
        break
    elif t % 2 and (dx+dy) % 2 == 0:
        failed = True
        break
    elif t % 2 == 0 and (dx+dy) % 2:
        failed = True
        break
    p = [x, y]


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

Submission status: Wrong Answer

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

point_a, point_b = 0, 0
for i in range(N):
    if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
        point_a += 1

for i in range(N):
    if point_a == 0 and (TXY[i+1][0] - TXY[i][0] % 2 != abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]) %2) :
        point_b += 1

if point_a == 0 and point_b == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

point = 0
for i in range(N):
    if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
        point += 1

for i in range(N):
    if TXY[i+1][0] - TXY[i][0] % 2 != abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]) %2 :
        point += 1

if point == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

point = 0
for i in range(N-1):
    if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
        point += 1

for i in range(N-1):
    if TXY[i+1][0] - TXY[i][0] % 2 != abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]) %2 :
        point += 1

if point == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
b = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if t < (x+y) or (t+x+y) % 2:
        print("NO")
        b = 1
        break
if b == 0:
    print("YES")

Submission status: Wrong Answer

Solution code:
N = int(input())
advancex = 0 
advancey = 0
advancetime = 0
check = True
for i in range(N):
    t,x,y = map(int,input().split())
    limit = t-advancetime
    if abs(advancex-x)+abs(advancey-y)>limit:
        check=False
        break
    if limit!=(abs(advancex-x)+abs(advancey-y))*2 and advancex==x and advancey == y:
        check = False
        break
    advancetime,advancex,advancey = t,x,y
if check == True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
advancex = 0 
advancey = 0
advancetime = 0
check = True
for i in range(N):
    t,x,y = map(int,input().split())
    limit = t-advancetime
    if abs(advancex-x)+abs(advancey-y)>limit:
        check=False
        break
    if advancex==x and advancey == y:
        check = False
        break
    advancetime,advancex,advancey = t,x,y
if check == True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def judge(t,x,y,t0,x0,y0):
  minT=abs(x-x0)+abs(y-y0)
  if (t-t0-minT)%2==0:
    return True
  else:
    return False
n=int(input())
lst=[tuple(int(i) for i in input().split()) for i in range(n)]
t0=0;x0=0;y0=0
for i in range(n):
  t,x,y=lst[i]
  if judge(t,x,y,t0,x0,y0):
    t0=t;x0=x;y0=y
    ans=True
  else:
    ans=False
    break
if ans:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
t0 = 0
x0 = 0
y0 = 0
for i in range(0, N):
    t1, x1, y1 = map(int, input().split())
    indicator = abs(x1-x0)+abs(y1-y0)-(t1-t0)
    if indicator>0 or indicator%2==1:
        print("NO")
        break
    elif i==N-1:
        print("YES")
        break
    t0 = t1
    x0 = x1
    y0 = y1

Submission status: Wrong Answer

Solution code:
n = int(input())
b = 1
tn,xn,yn = map(int,input().split())
for _ in range(n-1):
  to,xo,yo = tn,xn,yn
  tn,xn,yn = map(int,input().split())
  if tn-to >= abs(xn-xo)+abs(yn-yo) and (tn-to)%2 == (abs(xn-xo)+abs(yn-yo))%2:
    continue
  else:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
def check_rote(a, b, t, x, y):
    cost_min = abs(a - x) + abs(b - y)
    if cost_min <= t and (t - cost_min) % 2 == 0:
        return True
    else:
        return False

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

for i in range(n):
    rotes.append(tuple((int(x) for x in input().split())))

print(rotes)

copy_t = 0
copy_a = 0
copy_b = 0

for i in rotes:
    t, a, b = i
    if not check_rote(a, b, t - copy_t, copy_a, copy_b):
        print("No")
        break
    copy_t = t
    copy_a = a
    copy_b = b
else:
    print("Yes")

Submission status: Wrong Answer

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

for i in range(N - 1):
    dt.append(status[i + 1][0] - status[i][0])
    dist.append(abs(status[i + 1][1] - status[i][1]) + abs(status[i + 1][2] - status[i][2]))
    if ((dt[i] % 2 == 0 and dist[i] % 2 == 0) \
        or (dt[i] % 2 == 1 and dist[i] % 2 == 1)) \
        and (dist[i] <= dt[i]):
        flag.append(True)
    else:
        flag.append(False)

if all(flag):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

for i in range(N - 1):
    dt.append(status[i + 1][0] - status[i][0])
    dist.append(abs(status[i + 1][1] - status[i][1]) + abs(status[i + 1][2] - status[i][2]))
    if (dt[i] % 2 == 0 and dist[i] % 2 == 0) \
        or (dt[i] % 2 == 1 and dist[i] % 2 == 1):
        flag.append(True)
    else:
        flag.append(False)

if all(flag):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from scipy.spatial.distance import cityblock


answer = "Yes"
N = int(input())
points = [[int(i) for i in input().split()] for i in range(N)]


for t, x, y in points:
    mdist = cityblock(x, y)
    if (mdist - t)%2 != 0 or t < mdist:
        answer = "No"
        break

print(answer)

Submission status: Wrong Answer

Solution code:
import scipy as sp
from scipy.spatial.distance import cityblock

def delta(n):
    l = len([0])
    delta = n - sp.vstack((sp.zeros(l), n[1:]))
    return delta


answer = "Yes"
N = int(input())
points = sp.array([0,0,0])
for i in range(N):
    points = sp.vstack((points, [int(i) for i in input().split()]))

points = sp.array(list(points))


for t, x, y in points:
    mdist = cityblock(x, y)
    if (mdist - t)%2 != 0 or t < mdist:
        answer = "No"
        break

print(answer)

Submission status: Wrong Answer

Solution code:
import scipy as sp
from scipy.spatial.distance import cityblock

def delta(n):
    l = len([0])
    delta = n - sp.vstack((sp.zeros(l), n[1:]))
    return delta


answer = "Yes"
N = int(input())
points = sp.array([0,0,0])
for i in range(N):
    points = sp.vstack((points, [int(i) for i in input().split()]))

points = sp.array(list(points))


for t, x, y in points:
    mdist = cityblock(x, y)
    if mdist - t%2 != 0 or t < mdist:
        answer = "No"
        break

print(answer)