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:
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 and t < mdist:
        answer = "No"
        break

print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
x = []
y = []
for i in range(N):
    a,b,c = map(int,input().split())
    x.append(b)
    y.append(c)
count = 0
for i in range(N-1):
    if (x[i]-x[i+1])*(y[i]-y[i+1])==0 and abs((x[i]-x[i+1])+(y[i]-y[i+1])) == 1:
        count += 1
print("Yes") if count == N-1 else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
x = []
y = []
for i in range(N):
    a,b,c = map(int,input().split())
    x.append(b)
    y.append(c)
count = 0
for i in range(N-1):
    if (x[i]-x[i+1])*(y[i]-y[i+1])==0 and abs((x[i]-x[i+1])+(y[i]-y[i+1])):
        count += 1
print("Yes") if count == N-1 else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
txylist = [[0,0,0]]
for i in range(N):
    txylist.append(list(map(int,input().split())))
can = True
for i in range(1,N):
    t = txylist[i][0]-txylist[i-1][0]
    x = txylist[i][1]-txylist[i-1][1]
    y = txylist[i][2]-txylist[i-1][2]
    if (x + y) % 2 == t % 2 and abs(x) + abs(y) <= t:
        continue
    else:
        can = False
        break
if can:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# C
n = int(input())
preX = [0,0,0]
ans = True
for i in range(n):
    curX = list(map(int, input().split()))
    if not curX[0] - preX[0] >= (abs(curX[1] - preX[1]) + abs(curX[2] - preX[2])) and curX[0] - preX[0] % 2 == (abs(curX[1] - preX[1]) + abs(curX[2] - preX[2])) % 2:
        ans = False
if ans:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

cnt = 0
ans = "No"
for _ in range(N):
  t, x, y = map(int,input().split())
  if((t+x+y)%2 == 1 or t < x+y):
    cnt += 1
if(cnt == N):
  ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

cnt = 0
ans = "No"
for _ in range(N):
  t, x, y = map(int,input().split())
  if(t%(x+y) == 0 or t < x+y):
    cnt += 1
if(cnt == N):
  ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

cnt = 0
ans = "No"
for _ in range(N):
  t, x, y = map(int,input().split())
  if(t%(x+y) == 0):
    cnt += 1
if(cnt == N):
  ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]

h,j,k = 0,0,0

for i in range(n):
    t = abs(h - a[i][0])
    dx = abs(j - a[i][1])
    dy = abs(k - a[i][2])
    if t >= dx + dy:
        if t % 2 != (dx + dy % 2):
            print("No")
            sys.exit()
    else:
        print("No")
        sys.exit()
    h = a[i][0]
    j = a[i][1]
    k = a[i][2]
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[0 for i in range(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]=list(map(int,input().split(" ")))
t.insert(0,0)
x.insert(0,0)
y.insert(0,0)
for i in range(n-1):
    abx=abs(x[i]-x[i+1])
    aby=abs(y[i]-y[i+1])
    if abx+aby>t[i+1]-t[i] or (abs(x[i+1])+abs(y[i+1]))%2!=t[i+1]%2:
        print("No")
        exit(0)
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[0 for i in range(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]=list(map(int,input().split(" ")))
t.insert(0,0)
x.insert(0,0)
y.insert(0,0)
for i in range(n-1):
    abx=abs(x[i]-x[i+1])
    aby=abs(y[i]-y[i+1])
    if abx+aby>t[i+1]-t[i] or (abs(x[i+1])+abs(y[i+1]))%2!=t[i+1]%2:
        print("NO")
        exit(0)
print("YES")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[0 for i in range(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]=list(map(int,input().split(" ")))
x.insert(0,0)
y.insert(0,0)
for i in range(n-1):
    abx=abs(x[i]-x[i+1])
    aby=abs(y[i]-y[i+1])
    if abx+aby>t[i] or (abs(x[i+1])+abs(y[i+1]))%2!=t[i]%2:
        print("NO")
        exit(0)
print("YES")

Submission status: Wrong Answer

Solution code:
import sys
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
data = [[int(i) for i in l] for l in data]
data.insert(0, [0, 0, 0])
for i, l in enumerate(data):
    if i == 0:
        continue
    distance = abs(l[1]-data[i-1][1])+abs(l[2]-data[i-1][2])
    step_diff = l[0]-data[i-1][0]
    if step_diff%2 == distance%2 and (l[1]+l[2]) <= step_diff:
        continue
    else:
        print('No')
        sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
data = [[int(i) for i in l] for l in data]
data.insert(0, [0, 0, 0])
for i, l in enumerate(data):
    if i == 0:
        continue
    if (l[0]-data[i-1][0])%2 == 0:
        if (abs(l[1]-data[i-1][1])+abs(l[2]-data[i-1][2]))%2 == 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
            continue
        else:
            print('No')
            sys.exit()
    elif (l[0]-data[i-1][0])%2 != 0:
        if (abs(l[1]-data[i-1][1])+abs(l[2]-data[i-1][2]))%2 != 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
            continue
        else:
            print('No')
            sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
data = [[int(i) for i in l] for l in data]
data.insert(0, [0, 0, 0])
for i, l in enumerate(data):
    if i == 0:
        continue
    if (l[0]-data[i-1][0])%2 == 0:
        if (abs(l[1]-data[i-1][1])+abs(l[2]-data[i-1][2]))%2 == 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
            continue
        else:
            print('No')
            sys.exit()
    else:
        if (abs(l[1]-data[i-1][1])+abs(l[2]-data[i-1][2]))%2 != 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
            continue
        else:
            print('No')
            sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
data = [[int(i) for i in l] for l in data]
start = 0
for i, l in enumerate(data):
    if i == 0:
        if l[0]%2 == 0:
            if (l[1]+l[2])%2 == 0 and (l[1]+l[2]) <= l[0]-start:
                continue
            else:
                print('No')
                sys.exit()
        else:
            if (l[1]+l[2])%2 != 0 and (l[1]+l[2]) <= l[0]-start:
                continue
            else:
                print('No')
                sys.exit()
    else:
        if (l[0]-data[i-1][0])%2 == 0:
            if (abs(l[1]-data[i-1][1])+abs(l[2]-data[i-1][2]))%2 == 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
                continue
            else:
                print('No')
                sys.exit()
        else:
            if (abs(l[1]-data[i-1][1])+abs(l[2]-data[i-1][2]))%2 != 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
                continue
            else:
                print('No')
                sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
data = [[int(i) for i in l] for l in data]
start = 0
for i, l in enumerate(data):
    if i == 0:
        if l[0]%2 == 0:
            if (l[1]+l[2])%2 == 0 and (l[1]+l[2]) <= l[0]-start:
                continue
            else:
                print('No')
                sys.exit()
        else:
            if (l[1]+l[2])%2 != 0 and (l[1]+l[2]) <= l[0]-start:
                continue
            else:
                print('No')
                sys.exit()
    else:
        if (l[0]-data[i-1][0])%2 == 0:
            if abs(l[1]+l[2]-data[i-1][1]-data[i-1][2])%2 == 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
                continue
            else:
                print('No')
                sys.exit()
        else:
            if abs(l[1]+l[2]-data[i-1][1]-data[i-1][2])%2 != 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
                continue
            else:
                print('No')
                sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
data = [[int(i) for i in l] for l in data]
start = 0
for i, l in enumerate(data):
    if i == 0:
        if l[0]%2 == 0:
            if (l[1]+l[2])%2 == 0 and (l[1]+l[2]) <= l[0]-start:
                continue
            else:
                print('No')
                sys.exit()
        else:
            if (l[1]+l[2])%2 != 0 and (l[1]+l[2]) <= l[0]-start:
                continue
            else:
                print('No')
                sys.exit()
    else:
        if (l[0]-data[i-1][0])%2 == 0:
            if (l[1]+l[2])%2 != 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
                continue
            else:
                print('No')
                sys.exit()
        else:
            if (l[1]+l[2])%2 == 0 and (l[1]+l[2]) <= l[0]-data[i-1][0]:
                continue
            else:
                print('No')
                sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
plan = [tuple(map(int, input().split())) for _ in range(n)]
plan = [(0, 0, 0)] + plan
for i in range(n):
    ct, cx, cy = plan[i]
    nt, nx, ny = plan[i+1]
    t = nt - ct
    x = nx - cx
    y = ny - cy
    if abs(x) + abs(y) > 2 * t or (abs(x) + abs(y) - t) % 2:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

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

now_x = 0
now_y = 0
now_time = 0
for x in L:
    if x[0] % 2 != (x[1] + x[2]) % 2:
        print("No")
        quit()
    if abs(now_x-x[1]) + abs(now_y-x[2]) > x[0] - now_time:
        print("No")
        quit()
    now_time = x[0]
    now_x = x[1]
    now_x = x[2]
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
array_t = []
array_x = []
array_y = []
for i in range(N):
    t,x,y = map(int, input().split(" "))
    array_t.append(t)
    array_x.append(x)
    array_y.append(y)
flag = True
for i in range(N):
    if i ==0:
        added = abs(array_x[0])+abs(array_y[0])
        gap = array_t[0] - added
    else:
        added = abs(array_x[i]-array_x[i-1])+abs(array_y[i]+array_y[i-1])
        gap = array_t[i]-array_t[i-1] - added
    if gap>=0 and gap%2 == 0:
        continue
    else:
        print('No')
        flag = False
        break
if flag:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
array_t = []
array_x = []
array_y = []
for i in range(N):
    t,x,y = map(int, input().split(" "))
    array_t.append(t)
    array_x.append(x)
    array_y.append(y)
flag = True
for i in range(N):
    if i ==0:
        added = abs(array_x[0])+abs(array_y[0])
        gap = array_t[0] - added
    else:
        added = abs(array_x[i]-array_x[i-1])+abs(array_x[i]+array_y[i-1])
        gap = array_t[i]-array_t[i-1] - added
    if gap>=0 and gap%2 == 0:
        continue
    else:
        print('No')
        flag = False
        break
if flag:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
array_t = []
array_x = []
array_y = []
for i in range(N):
    t,x,y = map(int, input().split(" "))
    array_t.append(t)
    array_x.append(x)
    array_y.append(y)
flag = True
for i in range(N):
    if i ==0:
        added = abs(array_x[0])+abs(array_y[0])
        gap = array_t[0] - added
    else:
        added = abs(array_x[i]-array_x[i-1])+abs(array_x[i]+array_y[i-1])
        gap = array_t[i]-array_t[i-1] - added
    if gap>=0 and gap%2 == 0:
        continue
    else:
        print('NO')
        flag = False
        break
if flag:
    print('YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
routes = [(0,0,0)]
append = routes.append
for _ in range(0, N):
    t, x, y = map(int, input().split())
    append((t, x, y))
for i in range(1, N+1):
    bt, bx, by = routes[i-1]
    t, x, y = routes[i]
    ct = t - bt
    # xだけで考える。yとxは独立させて考えて問題ない。両方が成立しなければ成立しないため。
    cx = x - bx
    cy = y - by
    if cx > ct or cy > ct:
        print ("No")
        exit()
    if (cx+cy) % 2 != ct % 2:
        print ("No")
        exit()
print ("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
routes = [(0,0,0)]
append = routes.append
for _ in range(0, N):
    t, x, y = map(int, input().split())
    append((t, x, y))
for i in range(1, N+1):
    bt, bx, by = routes[i-1]
    t, x, y = routes[i]
    ct = t - bt
    # xだけで考える。yとxは独立させて考えて問題ない。両方が成立しなければ成立しないため。
    cx = x - bx
    if cx > ct or cx % 2 != ct % 2:
        print ("No")
        exit()
    cy = y - by
    if cy > ct or cy % 2 != ct % 2:
        print ("No")
        exit()
print ("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
routes = [(0,0,0)]
append = routes.append
for _ in range(0, N):
    t, x, y = map(int, input().split())
    append((t, x, y))
for i in range(1, N+2):
    bt, bx, by = routes[i-1]
    t, x, y = routes[i]
    ct = t - bt
    # xだけで考える。yとxは独立させて考えて問題ない。両方が成立しなければ成立しないため。
    cx = x - bx
    if cx > ct or cx % 2 != ct % 2:
        print ("No")
        exit()
    cy = y - by
    if cy > ct or cy % 2 != ct % 2:
        print ("No")
        exit()
print ("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
routes = [(0,0,0)]
append = routes.append
for _ in range(0, N):
    t, x, y = map(int, input().split())
    append((t, x, y))
for i in range(1, N+1):
    bt, bx, by = routes[i-1]
    t, x, y = routes[i]
    ct = t - bt
    # xだけで考える。yとxは独立させて考えて問題ない。両方が成立しなければ成立しないため。
    cx = x - bx
    if cx > ct or cx % 2 == ct % 2:
        print ("No")
        exit()
    cy = y - by
    if cy > ct or cy % 2 == ct % 2:
        print ("No")
        exit()
print ("Yes")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
t,x,y = 0,0,0
for i in range(n):
    t_,x_,y_ = map(int,input().split())
    X = x_ - x
    Y = abs(y_ - y)
    T = abs(t_ - t)
    if X > T or Y > T:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = float(input())
a = []
a.append([0,0,0])
for i in range(int(n)):
    in1, in2, in3 = map(float, input().split())
    a.append([in1,in2,in3])

for j in range(int(n)):
    i = j+1
    point_dif = abs(a[i][1]-a[i-1][1]) + abs(a[i][2] - a[i-1][2])
    if (a[i][0]-a[i-1][0])%2 == 1:        
        if int(point_dif)%2 == 1 & int(point_dif) <= a[i][0]-a[i-1][0]:
            c = 0
        else: 
            print('No')
            exit()
    if (a[i][0]-a[i-1][0])%2 == 0:
        if int(point_dif)%2 == 0 & int(point_dif) <= a[i][0]-a[i-1][0]:
            c=0
        else: 
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    t,x,y=map(int,input().split())
    if(not((x+y)<=t and not (x+y+t))):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    t, x, y=map(int, input().split())
    if not ((x+y)<=t and not (x+y+t)):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = "Yes"
for i in range(N):
  t, x, y = map(int,input().split())
  if(t < x+y and (t+x+y)%2 == 1):
    ans = "No"
    break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = [list(map(int,input().split())) for _ in range(N)]
ans = "Yes"
for i in range(N-1):
  t = txy[i+1][0] - txy[i][0]
  d = abs(txy[i][1] - txy[i+1][1]) + abs(txy[i][2] - txy[i+1][2])
  if(d <= t and t%2 == d%2):
    pass
  else:
    ans = "No"
    break
print(ans)

Submission status: Wrong Answer

Solution code:
int_n = int(input())

result = False
plan_array = [[0, 0, 0]]

for n in range(int_n):
    plan_array.append(list(map(int, input().split())))


# print(plan_array)

for n in range(int_n):
    dt = plan_array[n+1][0] - plan_array[n][0]
    dist = plan_array[n+1][1] - plan_array[n][1] + \
        plan_array[n+1][2] - plan_array[n][2]

    if dist > dt:
        result = False
        break

    if dt & 1 and dist & 1:
        result = True
    else:
        result = False

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

Submission status: Wrong Answer

Solution code:
int_n = int(input())

result = False
plan_array = [[0, 0, 0]]

for n in range(int_n):
    plan_array.append(list(map(int, input().split())))


print(plan_array)

for n in range(int_n):
    dt = plan_array[n+1][0] - plan_array[n][0]
    dist = plan_array[n+1][1] - plan_array[n][1] + \
        plan_array[n+1][2] - plan_array[n][2]

    if dist > dt:
        result = False
        break

    if dt & 1 and dist & 1:
        result = True
    else:
        result = False

if result:
    print('YES')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
t_now = 0
x_now = 0
y_now = 0
flag = True
for _ in range(n):
    t, x, y = map(int, input().split())
    if (y == y_now and x == x_now) or t < x + y or t == t_now:
        print('No')
        flag = False
        break
    t_now = t
    x_now = x
    y_now = y
if flag:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t_now = 0
x_now = 0
y_now = 0
flag = True
for _ in range(n):
    t, x, y = map(int, input().split())
    if t < abs(x - x_now) or t < abs(y - y_now) or (y == y_now and x == x_now) or t < x + y:
        print('No')
        flag = False
        break
    t_now = t
    x_now = x
    y_now = y
if flag:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t_now = 0
x_now = 0
y_now = 0
flag = True
for _ in range(n):
    t, x, y = map(int, input().split())
    if t < abs(x - x_now) or t < abs(y - y_now) or (y == y_now and x == x_now):
        print('No')
        flag = False
        break
    t_now = t
    x_now = x
    y_now = y
if flag:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t_now = 0
x_now = 0
y_now = 0
flag = True
for _ in range(n):
    t, x, y = map(int, input().split())
    if (x_now - t) > x > (x_now + t) or (y_now - t) > y > (y_now + t) or (y == y_now and x == x_now):
        print('No')
        flag = False
        break
    t_now = t
    x_now = x
    y_now = y
if flag:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t_now = 0
x_now = 0
y_now = 0
flag = True
for _ in range(n):
    t, x, y = map(int, input().split())
    if x > (x_now + t) or y > (y_now + t) or (y == y_now and x == x_now):
        print('No')
        flag = False
        break
    t_now = t
    x_now = x
    y_now = y
if flag:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N=int(input())
list=[]
flag=True
for i in range (N):
    tuple=input()
    input_list=tuple.split()
    input_list=[int(i) for i in input_list]
    list.append(input_list)
for i in range(N):
    time=list[i][0]
    distance=abs(list[i][1])+abs(list[i][2])
    if distance<=time:
        if distance%2==time%2:
            continue
        else:
            flag=False
    else:
        flag=False
if flag:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

for i in range(n - 1):
    t = rn[i + 1][0] - rn[i][0]
    distx = rn[i + 1][1] - rn[i][1]
    disty = rn[i + 1][2] - rn[i][2]
    k = abs(distx) + abs(disty)
    if (t >= k) and ((t + k) % 2 == 0):
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

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

for i in range(n - 1):
    t = rn[i + 1][0] - rn[i][0]
    distx = rn[i + 1][1] - rn[i][1]
    disty = rn[i + 1][2] - rn[i][2]
    k = abs(distx) + abs(disty)
    if (t > k) and ((t + k) % 2 == 0):
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
 t_new, x_new, y_new = map(int, input().split())
 l = abs(x_new - x) + abs(y_new - y)
 dt = t_new - t
 if (l <= dt) and (l % 2 == dt % 2 ):
  x = x_new
  y = y_new
  t = t_new
 else:
  #print(t, x, y) 
  print('NO')
  exit()
print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
 t_new, x_new, y_new = map(int, input().split())
 l = abs(x_new - x) + abs(y_new - y)
 dt = t_new - t
 if (l <= dt) and (l % 2 == dt % 2 ):
  x = x_new
  y = y_new
  t = t_new
 else:
  #print(t, x, y) 
  print('No')
  exit()
print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
 t_new, x_new, y_new = map(int, input().split())
 l = abs(x_new - x) + abs(y_new - y)
 dt = t_new - t
 if (l <= dt and l % 2 == dt % 2 ):
  x = x_new
  y = y_new
  t = t_new
 else:
  #print(t, x, y) 
  print('No')
  exit()
print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
 t_new, x_new, y_new = map(int, input().split())
 l = abs(x_new - x) + abs(y_new - y)
 dt = t_new - t
 if (l <= dt and abs(l - dt) % 2 == 0):
  x = x_new
  y = y_new
  t = t_new
 else:
  #print(t, x, y) 
  print('No')
  exit()
print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
 t_new, x_new, y_new = map(int, input().split())
 l = abs(x_new - x) + abs(y_new - y)
 dt = t_new - t
 if (l <= dt and abs(l - dt) % 2 == 0):
  x = x_new
  y = y_new
  t = t_new
 else:
  print('No')
  exit()
print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
 t, x, y = map(int, input().split())
 if (x + y <= t) and ((x + y - t) % 2 == 0):
  continue

 else:
  print('No')
  exit()
print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
 t_new, x_new, y_new = map(int, input().split())
 if ((abs(x_new - x) + abs(y_new - y)) <= (t_new - t)) and ((abs(x_new - x) + abs(y_new - y) - (t_new - t)) % 2 == 0):
  x = x_new
  y = y_new
  t = t_new
 else:
  print('No')
  exit()
print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
 t_new, x_new, y_new = map(int, input().split())
 print(t_new, x_new, y_new)
 if ((abs(x_new - x) + abs(y_new - y)) <= (t_new - t)) and ((abs(x_new - x) + abs(y_new - y) - (t_new - t)) % 2 == 0):
  x = x_new
  y = y_new
  t = t_new
 else:
  print('No')
  exit()
print('YES')

Submission status: Wrong Answer

Solution code:
N = int(input())


def canReach(start, T, x, y):
    target = (x, y)
    tmp = start
    for t in range(T):
        x_diff = target[0] - tmp[0]
        y_diff = target[1] - tmp[1]
        if abs(x_diff) >= abs(y_diff):
            tmp = (tmp[0]-1, tmp[1]) if x_diff < 0 else (tmp[0]+1, tmp[1])
        else:
            tmp = (tmp[0], tmp[1]-1) if y_diff < 0 else (tmp[0], tmp[1]+1)
    return tmp == target


start = (0, 0)
isReachAble = False
T = 0
for n in range(N):
    t, x, y = map(int, input().split())
    isReachAble = canReach(start, t-T, x, y)
    if (not isReachAble):
        print('No')
        exit()
    start = (x, y)
    T += t

print('Yes' if isReachAble else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())


def canReach(start, T, x, y):
    target = (x, y)
    tmp = start
    for t in range(T):
        x_diff = target[0] - tmp[0]
        y_diff = target[1] - tmp[1]
        if abs(x_diff) >= abs(y_diff):
            tmp = (tmp[0]-1, tmp[1]) if x_diff < 0 else (tmp[0]+1, tmp[1])
        else:
            tmp = (tmp[0], tmp[1]-1) if y_diff < 0 else (tmp[0], tmp[1]+1)
    return tmp == target


start = (0, 0)
isReachAble = False
T = 0
for n in range(N):
    t, x, y = map(int, input().split())
    isReachAble = canReach(start, t-T, x, y)
    if (not isReachAble):
        print('No')
        exit(0)
    start = (x, y)
    T += t

print('Yes' if isReachAble else 'No')

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==1:
  exit()
t0=x0=y0=0
f=0
for i in range(n):
  t,x,y=map(int,input().split())
  t1=t-t0
  x1=abs(x-x0)
  y1=abs(y-y0)
  if t1<x1+y1 or t1%2!=(x1+y1)%2:
    f=1
  t0=t
  x0=x
  y0=y
if f==1:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==2:
  exit()
t0=x0=y0=0
f=0
for i in range(n):
  t,x,y=map(int,input().split())
  t1=t-t0
  x1=abs(x-x0)
  y1=abs(y-y0)
  if t1<x1+y1 or t1%2!=(x1+y1)%2:
    f=1
  t0=t
  x0=x
  y0=y
if f==1:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==2:
  exit()
t0=x0=y0=0
f=0
for i in range(n):
  t,x,y=map(int,input().split())
  t-=t0
  x1=abs(x-x0)
  y1=abs(y-y0)
  if t<x1+y1 or t%2!=(x1+y1)%2:
    f=1
  t0=t
  x0=x
  y0=y
if f==1:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==1:
  exit()
t0=x0=y0=0
f=0
for i in range(n):
  t,x,y=map(int,input().split())
  t-=t0
  x1=abs(x-x0)
  y1=abs(y-y0)
  if t<x1+y1 or t%2!=(x1+y1)%2:
    f=1
  t0=t
  x0=x
  y0=y
if f==1:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

p = [None]*n

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

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if (abs(diff[1])+abs(diff[2]))>diff[0] or (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        exit()

print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())

p = [None]*n

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

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if (abs(diff[1])+abs(diff[2]))>diff[0] or (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        break
    elif i==n-1:
        print('YES')
        break

Submission status: Wrong Answer

Solution code:
n = int(input())

p = [None]*n

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

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if (abs(diff[1])+abs(diff[2]))>diff[0]:
        print('No')
        break
    elif (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        break
    elif i==n-1:
        print('YES')
        break

Submission status: Wrong Answer

Solution code:
n = int(input())

p = [None]*n

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

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if abs(diff[1])+abs(diff[2])>diff[0]:
        print('No')
        break
    elif (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        break
    elif i==n-1:
        print('YES')

Submission status: Wrong Answer

Solution code:
n = int(input())

p = [None]*n

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

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if abs(diff[1])+abs(diff[2])>diff[0]:
        print('No')
        break
    elif diff[0]-(abs(diff[1])+abs(diff[2]))%2==1:
        print('No')
        break
    elif i==n-1:
        print('YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = []
x = []
y = []
# 要素を配列に格納
for i in range(N):
    a_list = list(map(int, input().split()))
    t.append(a_list[0])
    x.append(a_list[1])
    y.append(a_list[2])

for n in range(N):
    if n == 0:
        offset_x = abs(x[n])
        offset_y = abs(y[n])
    else:
        offset_x = abs (x[n] - x[n-1])
        offset_y = abs (y[n] - y[n-1])
        
    offset_total = offset_x + offset_y
    time_offset = t[n] if n==0 else t[n] - t[n-1]
    if offset_total != time_offset:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t = []
x = []
y = []
# 要素を配列に格納
for i in range(N):
    a_list = list(map(int, input().split()))
    t.append(a_list[0])
    x.append(a_list[1])
    y.append(a_list[2])

for n in range(N):
    if n == 0:
        offset_x = abs(x[n])
        offset_y = abs(y[n])
    else:
        offset_x = abs (x[n] - x[n-1])
        offset_y = abs (y[n] - y[n-1])
        
    offset_total = offset_x + offset_y
    time_offset = 1 if n==0 else t[n] - t[n-1]
    if offset_total != time_offset:
        print("No")
        break
else:
    print("Yes")