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:
# coding: utf-8
# Your code here!
N = int(input())


cood = []
xbefore = 0
ybefore = 0
tbefore = 0
trigger = 0


for i in range(N):
    line = list(map(int ,input().split()))
    
    min_time = abs(line[1] - xbefore) + abs(line[2] - ybefore)
    time = line[0] - tbefore
    
    
        
    
    if time >= min_time:
        
        if (i == 0) and (line[1:3] == [0,0]):
            trigger = 1
        
        elif min_time % 2 == time % 2:
            trigger = 1
        
        else:
            print("No")
            break
            
        
        tbefore,xbefore,ybefore = line
    
    
    else:
        print("No")
        break
        
    
if trigger == 1:
    print("Yes")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N = int(input())


cood = []
xbefore = 0
ybefore = 0
tbefore = 0
trigger = 0

for i in range(N):
    line = list(map(int ,input().split()))
    
    min_time = abs(line[1] - xbefore) + abs(line[2] - ybefore)
    time = line[0] - tbefore
    
    if time >= min_time:
        
        if min_time % 2 == time % 2:
            trigger = 1
        
        else:
            print("No")
            break
            
        
        tbefore,xbefore,ybefore = line
    
    
    else:
        print("No")
        break
        
    
if trigger == 1:
    print("Yes")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N = int(input())


cood = []
xbefore = 0
ybefore = 0
tbefore = 0
trigger = 0

for i in range(N):
    line = list(map(int ,input().split()))
    
    min_time = (line[1] - xbefore) + abs(line[2] - ybefore)
    time = line[0] - tbefore
    
    if time >= min_time:
        
        if min_time % 2 == time % 2:
            trigger = 1
        
        else:
            print("No")
            break
            
        
        tbefore,xbefore,ybefore = line
    
    
    else:
        print("No")
        break
        
    
if trigger == 1:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
x = 0
y = 0
t = 0
for _ in range(N):
    ti, xi, yi = map(int, input().split())
    if abs(x-xi) + abs(y-yi) > ti - t:
        print('No')
        exit()
    if x == xi and y == yi:
        if not t % 2 == ti % 2:
            print('No')
            exit()
    x = xi
    y = yi
    t = ti

print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
x = 0
y = 0
t = 0
for _ in range(N):
    ti, xi, yi = map(int, input().split())
    if abs(x-xi) + abs(y-yi) > ti - t or (x == xi and y == yi):
        print('No')
        exit()
    x = xi
    y = yi
    t = ti

print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
pt, px, py = 0, 0, 0
for _ in range(N):
    ct, cx, cy = map(int, input().split())
    diff_t = ct-pt
    diff_x = cx - px
    diff_y = cy - py

    diff_xy = abs(diff_x+diff_y)
    if diff_xy > diff_t:
        print('No')
        exit()
    if (diff_xy + diff_t) % 2 == 0:
        print('No')
        exit()

    px = cx
    py = cy
    pt = ct

print('Yes')

Submission status: Wrong Answer

Solution code:
# AtCoder
N = int(input())
pt, px, py = 0, 0, 0
for _ in range(N):
    ct, cx, cy = map(int, input().split())
    diff_t = ct-pt
    diff_x = cx - px
    diff_y = cy - py

    diff_xy = abs(diff_x+diff_y)
    if diff_xy > diff_t:
        print('No')
        exit()
    if (diff_xy + diff_t) % 2 == 0:
        print('No')
        exit()

    px = diff_x
    py = diff_y
    pt = diff_t

print('Yes')

Submission status: Wrong Answer

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

if txy[0][0] < txy[0][1]+txy[0][2]:
    print('No')
    exit()

for i in range(1, N):
    ct = txy[i][0]
    cx = txy[i][1]
    cy = txy[i][2]
    pt = txy[i-1][0]
    px = txy[i-1][1]
    py = txy[i-1][2]

    cxy = cx + cy
    pxy = px + py

    difxy = abs(cxy - pxy)
    dift = abs(ct-pt)
    print(difxy, dift)
    if dift % 2 != 0 and difxy % 2 == 0:
        print('No')
        exit()
    elif dift % 2 == 0 and difxy % 2 != 0:
        print('No')
        exit()

    if difxy > dift:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

Solution code:
N = int(input())

tprev = 0
xprev = 0
yprev = 0

result = 'YES'

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

    xlen = abs(x - xprev)
    ylen = abs(y - yprev)
    
    time = t - tprev

    length = xlen + ylen

    if time%2 == length%2 and time >= length:
        tprev = t
        xprev = x
        yprev = y

    else:
        result = 'NO'
        break
print(result)

Submission status: Wrong Answer

Solution code:
from sys import exit


n = int(input())

ans = 0
for q in range(n):
    limit, x, y = map(int, input().split())
    if limit < (x + y) or (limit + x + y) % 2:
        print("NO")
        exit(0)


print("YES")

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0
for q in range(n):
    limit, x, y = map(int, input().split())
    if (limit < x + y) or (limit - x - y) % 2 != 0:
        ans += 1


print("NO" if ans else "YES")

Submission status: Wrong Answer

Solution code:
n = int(input())

my_pos_x = 0
my_pos_y = 0

for i in range(n):
    t, x, y = map(int, input().split())
    for j in range(t):
        if my_pos_x < x:
            my_pos_x = + 1
            continue
        elif my_pos_x > x:
            my_pos_x = - 1
            continue
        else:
            if my_pos_y < y:
                my_pos_y = + 1
                continue
            elif my_pos_y > y:
                my_pos_y = + -1
                continue
            else:
                my_pos_x += 1
    if my_pos_x != x and my_pos_y != y:
        print("NO")
        exit(0)

if my_pos_x == x and my_pos_y == y:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
n = int(input())

my_pos_x = 0
my_pos_y = 0

for i in range(n):
    t, x, y = map(int, input().split())
    for j in range(t):
        if my_pos_x < x:
            my_pos_x = + 1
            continue
        elif my_pos_x > x:
            my_pos_x = - 1
            continue
        else:
            if my_pos_y < y:
                my_pos_y = + 1
                continue
            elif my_pos_y > y:
                my_pos_y = + -1
                continue
            else:
                my_pos_x += 1

if my_pos_x == x and my_pos_y == y:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[list(map(int,input().split())) for _ in range(N)]
dp=[[0,0] for _ in range(N+1)]
dp[0][0]=1
for i in range(1,N+1):
  t=a[i-1][0]-dp[i-1][1]
  x=a[i-1][1]
  y=a[i-1][2]
  if t>=x+y and t%2==(x+y+dp[i-1][1])%2 and dp[i-1][0]==1:
    dp[i][0]=1
    dp[i][1]=a[i-1][0]
if dp[N][0]==1:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[list(map(int,input().split())) for _ in range(N)]
dp=[[0,0] for _ in range(N+1)]
dp[0][0]=1
for i in range(N):
  t=a[i][0]-dp[i-1][1]
  x=a[i][1]
  y=a[i][2]
  if t>=x+y and t%2==(x+y+dp[i-1][1])%2 and dp[i-1][0]==1:
    dp[i][0]=1
    dp[i][1]=a[i][0]
if dp[N-1][0]==1:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[list(map(int,input().split())) for _ in range(N)]
dp=[[0,0] for _ in range(N)]
for i in range(N):
  t=a[i][0]-dp[i-1][1]
  x=a[i][1]
  y=a[i][2]
  if t>=x+y and t%2==(x+y+dp[i-1][1])%2 and dp[i-1][0]==1:
    dp[i][0]=1
    dp[i][1]=a[i][0]
if dp[N-1][0]==1:print("Yes")
else:print("No")

Submission status: Wrong Answer

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

x=[list(map(int,input().split())) for _ in range(N)]
x.insert(0,[0,0,0])



for i in range(N):
  if abs(x[i][0]-x[i+1][0])<(abs(x[i][1]-x[i+1][1])+abs(x[i][2]-x[i+1][2])):
    flag=1
  if x[i][1]==x[i+1][1] and x[i][2]==x[i+1][2]:
    flag=1

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

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())

T = []
m = []
for _ in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    m.append([x,y])

for n in range(N-1):
    dl = abs(m[n][0]-m[n+1][0])+abs(m[n][1]-m[n+1][1])
    dt = T[n+1]-T[n]
    if dl>dt:
        print("No")
        sys.exit()
    if dl%2!=dt%2:
        print("No")
        sys.exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())

#1行ずつ読んでやる方がスマートだけど、とりあえず見た目わかりやすい方で

t = [0] * (n+1)
x = [0] * (n+1)
y = [0] * (n+1)

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

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

Submission status: Wrong Answer

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

for i in range(N):
  if abs(Sorted[i+1][1] - Sorted[i][1]) + abs(Sorted[i+1][2] - Sorted[i][2]) > Sorted[i+1][0] - Sorted[i][0]:
    print("No")
    break
  elif abs(Sorted[i+1][1] - Sorted[i][1]) == 0 and abs(Sorted[i+1][2] - Sorted[i][2]) == 0:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

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

for i in range(N):
  if abs(Sorted[i+1][1] - Sorted[i][1]) + abs(Sorted[i+1][2] - Sorted[i][2]) > Sorted[i+1][0] - Sorted[i][0]:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
rows = [list(map(int,input().split())) for _ in range(N)]

pos = [0,0]
time = 0
for row in rows:
    t,x,y = row
    tt = t - time
    xx = abs(x-pos[0])
    yy = abs(y-pos[1])
    num = tt-(xx+yy)
    if num>=0 and num%2==0:
        pos = [x,y]
        time = 3
    else:
        print("No")
        exit()

print("Yes")
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Wrong Answer

Solution code:
def myAnswer(N:int, txy:list) -> str:
   prexy = 0
   pret = 0
   for t,x,y in txy:
      xy =abs(prexy -(x + y))
      if((t - pret) % xy !=0):
         return "No"
      else:
         prexy = x + y
         pret = t

   return "Yes"

def modelAnswer():
   return
def main():
   N = int(input())
   txy = []
   for _ in range(N):
      txy.append(list(map(int,input().split())))
   print(myAnswer(N,txy[:]))
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
def myAnswer(N:int, txy:list) -> str:
   pre = 0
   for t,x,y in txy:
      xy =abs(pre -(x + y))
      if(t % xy !=0):
         return "No"
      else:
         pre = x + y
   return "Yes"

def modelAnswer():
   return
def main():
   N = int(input())
   txy = []
   for _ in range(N):
      txy.append(list(map(int,input().split())))
   print(myAnswer(N,txy[:]))
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
num_list=int(input())
a=[1,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and dt%2==d%2:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break

Submission status: Wrong Answer

Solution code:
num_list=int(input())
a=[1,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  print("i=",i,"a=",a,"b=",b)
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and d != 0 and dt%2==d%2:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break

Submission status: Wrong Answer

Solution code:
num_list=int(input())
a=[1,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and d != 0 and (dt-d)%2==0:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break

Submission status: Wrong Answer

Solution code:
num_list=int(input())
a=[1,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  if (abs(b[1]-a[1])+abs(b[2]-a[2]))<=(b[0]-a[0]) and (abs(b[1]-a[1])+abs(b[2]-a[2])) != 0:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break

Submission status: Wrong Answer

Solution code:
n = int(input())
location = [[0]*3]*n

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

#print(location) -> [[3, 1, 2], [6, 1, 1]]

x = 0
y = 0
for i in range(n):# 合計値と同じ奇数or偶数になっていればいいのでは
    if location[i][0] < location[i][1] or location[i][0] < location[i][2]:
        print("No")
        flag = False
        break
    elif location[i][0] % 2 != (location[i][1] + location[i][2]) % 2:
        print("No")
        flag = False
        break
    else:
        flag = True

if flag:
    print("Yes")

Submission status: Wrong Answer

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

s=0
for i in range(1,N+1):
  if abs(L[i][1]-L[i-1][1])+abs(L[i][2]-L[i-1][2]) > L[i][0]-L[i-1][0]:
    s=1
    break

print("Yes" if s==0 else "No")

Submission status: Wrong Answer

Solution code:
#10
N = int(input())
t = [list(map(int, input().split())) for i in range(N)]
x = 0
y = 0
flag = False
for i in range(N):
    for x in range(0, t[i][0]):
        for y in range(0, t[i][0]-x):
            if x == t[i][1] and y == t[i][2]:
                x = t[i][1]
                y = t[i][2]
                flag = True
                break
        if flag:
            break

print('Yes' if x==t[-1][1] and y==t[-1][2] else 'No')

Submission status: Wrong Answer

Solution code:
n = int(input())
ti,xi,yi = [0],[0],[0]
ans = 'NO'

for ni in range(n):
 t,x,y = [int(x) for x in input().split()]
 ti.append(t)
 xi.append(x)
 yi.append(y)

for i in range(n):
  dt = ti[i+1] - ti[i]
  dx = xi[i+1] - xi[i]
  dy = yi[i+1] - yi[i]

  if dt < abs(dx)+abs(dy):
    break

  odev1 = (xi[i]+yi[i])%2
  odev2 = (xi[i+1]+yi[i+1])%2

  if dt%2 == 0:
    if odev1 != odev2:
      break
  else:
    if odev1 == odev2:
      break
  if i == n-1:
    ans = 'YES'

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import numpy as np


def canReach(src, dst):
    a = (dst[0] - src[0]) - np.sum(np.abs(src-dst)[1:3])
    if a >= 0 and a % 2 == 0:
        return True
    return False


N = int(input())
dst = np.array([[int(x) for x in input().split(" ")] for z in range(N)])
exit(0)
available = True
prev_dst = np.array([0] * 3)

for n in range(N):
    t,x,y = map(int, input().split(" "))
    if canReach(prev_dst, np.array([t,x,y])):
        prev_dst = np.array([t,x,y])
    else:
        available = False
        break

if available:
    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:
#!/usr/bin python3
# -*- coding: utf-8 -*-

import numpy as np

def canReach(src, dst):
    a = np.sum(np.abs(src-dst)[1:3]) - (dst[0] - src[0])
    if a >= 0 and a % 2 == 0:
        return True
    return False

N = int(input())
dst = np.array([[int(x) for x in input().split(" ")] for z in range(N)])

available = True
pos = [0, 0, 0]

for n in range(N):
    if not canReach(pos, dst[n]):
        available = False
        break
    else:
        pos = dst[n]

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

Submission status: Wrong Answer

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

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

for i in range(n):
    t = c[i][0] - t
    a = c[i][1]
    b = c[i][2]

    if (t - abs((x+y) - (a+b))) %2 == 0 and abs((x+y) - (a+b)) <= t:
        x = a
        y = b
    else:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())

def check_distance(move_distance, move_time):
  buf_result = False

  if move_distance / move_time >= 1:
    buf_val = move_distance % move_time

    if buf_val % 2 == 0:
      buf_result = True

  return buf_result

current_posi = [0, 0]
next_posi = []

current_time = 0
next_time = 0

result = False

for i in range(n):
  input_i = list(map(int, input().split()))
  next_time = input_i[0]
  next_posi = [input_i[1], input_i[2]]

  move_distance = abs(current_posi[0] - next_posi[0]) + abs(current_posi[1] - next_posi[1])

  move_time = next_time - current_time

  result = check_distance(move_distance, move_time)

  if result == False:
    break


if result == False:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    if abs(x-X)+abs(y-Y) <= t-T and t-T % 2 == (abs(x-X)+abs(y-Y)) % 2:
        count += 1
    T, X, Y = t, x, y
print("Yes" if count == N else "No")

Submission status: Wrong Answer

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

a='Yes'
for i in range(n):
    t,x,y=map(int,input().split())
    if abs(x-X)+abs(y-Y)>t-T or t%2!=(x+y)%2:
        a='NO'
        break
    T,X,Y=t,x,y
print(a)

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 + x + y)%2 != 0:
        break
    print("No")
        
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
prev_t = 0
for i in range(n):
    t, x, y=map(int, input().split())
    if (x + y) > (t - prev_t) or (x + y + (t - prev_t)) % 2:
        print("No")
        exit()
    prev_t = t
print("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 + x + y)%2 != 0:
        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):
    t, x, y = map(int, input().split())
    if (t - T) < abs(x-X) + abs(y-Y) or ((t - T) + abs(x-X) + abs(y-Y))%2 == 1:
        print("No")
        break
    t = T
    X = x
    Y = y
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

T = 0
X = 0
Y = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if ((t - T) + abs(x-X) + abs(y-Y))%2 == 1 or (t - T) < abs(x-X) + abs(y-Y):
        print("No")
        break
    t = T
    X = x
    Y = y
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

T = 0
X = 0
Y = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if (((t - T) + abs(x-X) + abs(y-Y))%2 == 1) and ((t - T) < (abs(x-X) + abs(y-Y))):
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

T = 0
X = 0
Y = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if ((t - T) + abs(x-X) + abs(y-Y))%2 == 1 and (t - T) < abs(x-X) + abs(y-Y):
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline

N = I()
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(N):
    t,x,y = map(int,input().split())
    t = t-prev_t
    if abs(x-prev_x)+abs(y-prev_y) > t:
        print('No')
        break
    elif (abs(x-prev_x)+abs(y-prev_y)) %2 != t%2:
        print('No')
        break
    prev_t = t
    prev_x = x
    prev_y = y
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline

N = I()
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(N):
    t,x,y = map(int,input().split())
    t = t-prev_t
    if abs(x-prev_x)+abs(y-prev_y) > t:
        print('No')
        break
    if (abs(x-prev_x)+abs(y-prev_y)) %2 != t%2:
        print('No')
        break
    prev_t = t
    prev_x = x
    prev_y = y
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline

N = I()
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(N):
    t,x,y = map(int,input().split())
    t = t-prev_t
    if abs(x-prev_x)+abs(y-prev_y) > t:
        print('No')
    if (abs(x-prev_x)+abs(y-prev_y)) %2 != t%2:
        print('No')
        break
    prev_t = t
    prev_x = x
    prev_y = y
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline

N = I()
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(N):
    t,x,y = map(int,input().split())
    t = t-prev_t
    if abs(x-prev_x)+abs(y-prev_y) > t:
        print('No')
        break
    if (t-abs(x-prev_x)+abs(y-prev_y)) % 2 ==1:
        print('No')
        break
    prev_t = t
    prev_x = x
    prev_y = y
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline

N = I()
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(N):
    t,x,y = map(int,input().split())
    t = t-prev_t
    if abs(x-prev_x)+abs(y-prev_y) > t:
        print('No')
        break
    if (abs(x-prev_x)+abs(y-prev_y)-t) % 2 ==1:
        print('No')
        break
    prev_t = t
    prev_x = x
    prev_y = y
else:
    print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
point = [0, 0]
t_list = []
ans = "Yes"
t = list(map(int, input().split()))
dis = abs(point[0]-t[1])+abs(point[1]-t[2])
t_list.append(t)
if t[0] < dis:
    ans = "No"
point = [t[1], t[2]]
for i in range(N-1):
    t = list(map(int, input().split()))
    dis = abs(point[0]-t[1])+abs(point[1]-t[2])
    if t_list[-1][0]-t[0] < dis:
        ans = "No"
    point = [t[1], t[2]]
    t_list.append(t)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

# print(f"t:{t}\nx:{x}\ny:{y}")

for index in range(1, N + 1):
    distance = (x[index] - x[index - 1]) + (y[index] - y[index - 1])
    if (t[index] - t[index - 1]) % 2 != distance % 2:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int,input().split()))for _ in range(n)]
ok = True
time = 0
nx = 0
ny = 0
for i in range(n):
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    dist = abs(x-nx)+abs(y-ny)
    if not(t - time >= dist and (t- time )%2 == dist%2):
        ok = False
        break
    time+=t
    nx = x
    ny = y
if ok:print('Yes')
else:print('No')

Submission status: Wrong Answer

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

print(scedule)

for i in range(N):
    timelimit = scedule[i+1][0] - scedule[i][0]
    x_distance = abs(scedule[i+1][1] - scedule[i][1])
    y_distance = abs(scedule[i+1][2] - scedule[i][2])

    if timelimit < (x_distance + y_distance):
        print("No")
        exit()
    if timelimit % (x_distance + y_distance) != 0:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())

t_arr = [0]*(n+1)
x_arr = [0]*(n+1)
y_arr = [0]*(n+1)

for i in range(n+1):
    # 先頭はt0 x0 y0 なのでそのままにする
    if i == 0:continue
    pos = input().split()
    t_arr[i] = int(pos[0])
    x_arr[i] = int(pos[1])
    y_arr[i] = int(pos[2])

is_possible = False

for i in range(n):
    # 次の場所までに移動できる時間(回数)
    t = t_arr[i+1] - t_arr[i];
    
    # 次の場所までの距離
    x = abs(x_arr[i] - x_arr[i+1])
    y = abs(y_arr[i] - y_arr[i+1])
    d = x + y
    
    if d <= t and t%2 == d%2:
        is_possible = True
        break
    
print("Yes" if is_possible else "No")

Submission status: Wrong Answer

Solution code:
N = int(input())
now = [0,0]
tnow = 0
ans = 'Yes'
for i in range(N):
    t,x,y = map(int,input().split())
    dis = abs(x-now[0]) + abs(y-now[1])
    if t-tnow < dis:
        ans = 'No'
        break
    if now == [x,y] and t-tnow <= 1:
        ans = 'No'
        break
    tnow = t
    now = [x,y]
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
now = [0,0]
tnow = 0
ans = 'Yes'
for i in range(N):
    t,x,y = map(int,input().split())
    dis = abs(x-now[0]) + abs(y-now[1])
    if t-tnow < dis:
        ans = 'No'
        break
    tnow = t
    now = [x,y]
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0 for i in range(N)]    # リストには最初に要素をN個作っておかないとエラーになる
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())

a = "YES"
# ここまでが入力
for i in range(N):
    if i == 0:
        dt = t[0]
        dist = abs(x[0]) + abs(y[0])
    else:
        dt = t[i]-t[i-1]
        dist = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if dist > dt or (dist+dt) % 2 == 1:
        a = "NO"

print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0 for i in range(N)]    # リストには最初に要素をN個作っておかないとエラーになる
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())

a = "YES"
# ここまでが入力
for i in range(N):
    if i == 0:
        dt = t[0]
        dist = abs(x[0]) + abs(y[0])
    else:
        dt = t[i]-t[i-1]
        dist = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if dist > dt or (dist+dt) % 2 == 1:
        a = "NO"

print(a)