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:
def solve():
    N = int(input())
    plan = [
        [int(x) for x in input().split()] for _ in range(N)
    ]
    plan = [[0, 0, 0]] + plan

    for i in range(1, N+1):
        t0, x0, y0 = plan[i-1]
        t, x, y = plan[i]
        dx = x - x0
        dy = y = y0
        d = abs(dx) + abs(dy)

        if t - t0 < d:
            return False

        if (t-t0-d)%2 != 0:
            return False

    return True


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

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())
    plan = [
        [int(x) for x in input().split()] for _ in range(N)
    ]
    plan = [[0, 0, 0]] + plan

    for i in range(1, N+1):
        t0, x0, y0 = plan[i-1]
        t, x, y = plan[i]
        dx = x - x0
        dy = y = y0
        dt = abs(dx) + abs(dy)

        if t0 + dt > t:
            return False

        if (t-dt)%2 != 0:
            return False

    return True


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

Submission status: Wrong Answer

Solution code:
N = int(input())

for l in range(1, N+1):
  t1, x1, y1 = [int(l) for l in input().split()]
  if l != N:
    continue
  elif l == N:
    result = abs(x1) + abs(y1)
    if result <= t1:
      print("Yes")
    elif result > t1:
      print("No")
    else:
      print("Error")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

start = 0
startX = 0
startY = 0

for i in range(n):
    t, x, y = map(int, input().split())
    t_diff = t - start
    dis = abs(x - startX) + abs(y - startY)
    if t_diff < dis:
        print('No')
        break
    elif (dis + t_diff) % 2 != 0:
        print('No')
        break
    start, startX, startY = t, x, y
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

start = 0
startX = 0
startY = 0

for i in range(n):
    t, x, y = map(int, input().split())
    if t - start < abs(x - startX) + abs(y - startY):
        print('No')
        break
    start, startX, startY = t, x, y
print('Yes')

Submission status: Wrong Answer

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

ans = 'No'
for i in range(n):
    time = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i][1] - txy[i + 1][1]) + abs(txy[i][2] - txy[i + 1][2])
    if time - dist == 0:
        ans = 'Yes'
    elif time - dist > 0 and (time - dist) % 2 == 0:
        ans = 'Yes'
        
print(ans)

Submission status: Wrong Answer

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

ans = 'No'
for i in range(n - 1):
    time = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i][1] - txy[i + 1][1]) + abs(txy[i][2] - txy[i + 1][2])
    if time - dist == 0:
        ans = 'Yes'
    elif time - dist > 0 and (time - dist) % 2 == 0:
        ans = 'Yes'
        
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
for i in range(n):
    x, y, z = map(int, input().split())

    if(x%2 == (y+z)%2 and (x > y) and (x > z)):
        continue
    else:
        print('No')
        ans = 1
        break
if(ans == 0):
    print('Yes')

Submission status: Wrong Answer

Solution code:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5+2,2)
ce = range(0,10**5+2,2)
f = 1
def say(i):return print("Yes" if i == 1 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n+1):
    t = k[i]-k[i-1]
    if t%2==1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 1
    elif t%2!=1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 1
    else:
        f = 0
        break
say(f)

Submission status: Wrong Answer

Solution code:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5+2,2)
ce = range(0,10**5+2,2)
f = 1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n+1):
    t = k[i]-k[i-1]
    if not t%2==1 and abs(l[i]-l[i-1]) in ce[:t//2+1]:
        f = 0
        break
    elif not t%2!=1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 0
        break
say(f)

Submission status: Wrong Answer

Solution code:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5,2)
ce = range(0,10**5,2)
f = 1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n+1):
    t = k[i]-k[i-1]
    if not t%2==1 and abs(l[i]-l[i-1]) in ce[:t//2+1]:
        f = 0
        break
    elif not t%2!=1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 0
        break
say(f)

Submission status: Wrong Answer

Solution code:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5,2)
ce = range(0,10**5,2)
f = 1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n):
    t = k[i]-k[i-1]
    if not t%2==1 and abs(l[i]-l[i-1]) in ce[:t//2+1]:
        f = 0
        break
    elif not t%2!=1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 0
        break
say(f)

Submission status: Wrong Answer

Solution code:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5,2)
ce = range(0,10**5,2)
f = 1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n):
    t = k[i]-k[i-1]
    if not t%2==1 and abs(l[i]-l[i-1]) in ce[:t//2+1]:
        f = 0
    elif not t%2!=1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 0
say(f)

Submission status: Wrong Answer

Solution code:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5,2)
ce = range(0,10**5,2)
f = 1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n):
    t = k[i]-k[i-1]
    if not t%2==1 and l[i]-l[i-1] in ce[:t//2+1]:
        f = 0
    elif not t%2!=1 and l[i]-l[i-1] in co[:t//2+1]:
        f = 0
say(f)

Submission status: Wrong Answer

Solution code:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5,2)
ce = range(0,10**5,2)
f = 1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n):
    t = k[i]-k[i-1]
    if not t%2==1 and l[i]-l[i-1] in ce[:t-1]:
        f = 0
    elif not t%2!=1 and l[i]-l[i-1] in co[:t-1]:
        f = 0
say(f)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):

    return [il(t) for _ in range(N)]


N = ii()
# 時刻ｔにx, yを訪れる
# t+1 で (x+1, y), (x-1, y), (x, y+1), (x, y-1)に移動
T = [0] * (N + 1)
X = [0] * (N + 1)
Y = [0] * (N + 1)
for n in range(N):
    t = il()
    T[n + 1] = t[0]
    X[n + 1] = t[1]
    Y[n + 1] = t[2]
for i in range(N):
    dt = T[i + 1] - T[i]
    dst = abs(X[i + 1] - X[i]) + abs(Y[i + 1] - Y[i])
    if dt < dst or dt % 2 != dst % 2:
        print("NO")
        exit()
print("YES")

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):

    return [il(t) for _ in range(N)]


def solve():
    N = ii()
    # 時刻ｔにx, yを訪れる
    # t+1 で (x+1, y), (x-1, y), (x, y+1), (x, y-1)に移動
    T = [0] * (N + 1)
    X = [0] * (N + 1)
    Y = [0] * (N + 1)
    for n in range(N):
        t = il()
        T[n + 1] = t[0]
        X[n + 1] = t[1]
        Y[n + 1] = t[2]
    for i in range(N):
        dt = T[i + 1] - T[i]
        dst = abs(X[i + 1] - X[i]) + abs(Y[i + 1] - Y[i])
        if dt < dst or dt % 2 != dst % 2:
            return "NO"
    return "YES"


if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = []
for i in range(N):
    txy.append(list(map(int,input().split())))
flag = 0
if N == 1:
    dt = txy[0][0]
    dx = txy[0][1]
    dy = txy[0][2]
    if (dx+dy-dt)%2 == 0 and (dx+dy) <= dt:
        pass
    else:
        flag = 1
        print("No")
for j in range(N-1):
    if j == 0:
        dt = txy[0][0]
        dx = txy[0][1]
        dy = txy[0][2]
    else:
        dt = txy[j+1][0]-txy[j][0]
        dx = abs(txy[j+1][1]-txy[j][1])
        dy = abs(txy[j+1][2]-txy[j][2])
    if (dx+dy-dt)%2 == 0 and (dx+dy) <= dt:
        pass
    else:
        flag = 1
        print("No")
if flag == 0:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
x = y = 0

for _ in range(N):
    print(_)
    t, _x, _y = map(int, input().split())
    dist = abs(_y - y) + abs(_x - x)
    if dist > t or (t - dist) % 2 == 1:
        print('No')
        quit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
x = y = 0

for _ in range(N):
    print(_)
    t, _x, _y = map(int, input().split())
    dist = abs(_y - y) + abs(_x - x)
    if dist > t or (t - dist) % 2 == 1:
        print('no')
        quit()
print('yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
txy = [[0, 0, 0]]
ans = 'Yes'

for i in range(N):
    txy.append(list(map(int, input().split())))

for i in range(0, N):
    t = abs(txy[i][0] - txy[i+1][0])
    x = abs(txy[i][1] - txy[i+1][1])
    y = abs(txy[i][2] - txy[i+1][2])

    if x + y != t or t % 2 != x % 2 + y % 2:
        ans = 'No'
        break
print(ans)

Submission status: Wrong Answer

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

s = (0, 0)
t = 0
success = True

for move in In:
    before_x, before_y = s
    tn, after_x, after_y = move

    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)
    walk = tn - t

    if walk < dist_xy:
        success *= False

    if walk % 2 == 0 and dist_xy % 2 != 0:
        success *= False
    elif walk % 2 != 0 and dist_xy % 2 == 0:
        success *= False

    s = (after_x, after_y)
    t = tn

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

Submission status: Wrong Answer

Solution code:
def intime(t, dx, dy):
    x, y = map(abs, (dx, dy))
    return x + y <= t


N = int(input())
bx, by = 0, 0

ans = True
for i in range(N):
    t, x, y = map(int, input().split())
    if x - bx == 0 and y - by == 0:
        ans = False
    if not intime(t, x - bx, y - by):
        ans = False
    bx, by = x, y

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

Submission status: Wrong Answer

Solution code:
def intime(t, dx, dy):
    x, y = map(abs, (dx, dy))
    return True if x + y <= t else False


N = int(input())
bx, by = 0, 0

ans = True
for i in range(N):
    t, x, y = map(int, input().split())
    if x == 0 and y == 0:
        ans = False
    if not intime(t, x - bx, y - by):
        ans = False
    bx, by = x, y

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

Submission status: Wrong Answer

Solution code:
def intime(t, dx, dy):
    x, y = map(abs, (dx, dy))
    if x == 0 and y == 0:
        return False
    return True if dx + dy <= t else False


N = int(input())
bx, by = 0, 0

ans = True
for i in range(N):
    t, x, y = map(int, input().split())
    if not intime(t, x - bx, y - by):
        ans = False
    bt, bx, by = t, x, y

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

Submission status: Wrong Answer

Solution code:
def intime(t, dx, dy):
    x, y = map(abs, (dx, dy))
    if x == 0 and y == 0:
        return False
    return True if dx + dy < t else False


N = int(input())
bx, by = 0, 0

ans = True
for i in range(N):
    t, x, y = map(int, input().split())
    if not intime(t, x - bx, y - by):
        ans = False
    bt, bx, by = t, x, y

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

Submission status: Wrong Answer

Solution code:
def intime(t, dx, dy):
    x, y = map(abs, (dx, dy))
    if t < 2 and x == 0 and y == 0:
        return False
    return True if dx + dy < t else False


N = int(input())
bx, by = 0, 0

ans = True
for i in range(N):
    t, x, y = map(int, input().split())
    if not intime(t, x - bx, y - by):
        ans = False
    bt, bx, by = t, x, y

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

Submission status: Wrong Answer

Solution code:
def intime(t, dx, dy):
    x, y = map(abs, (dx, dy))
    if t < 2 and x == 0 and y:
        return False
    return True if dx + dy < t else False


N = int(input())
bx, by = 0, 0

ans = True
for i in range(N):
    t, x, y = map(int, input().split())
    if not intime(t, x - bx, y - by):
        ans = False
    bt, bx, by = t, x, y

print('Yes' if ans else '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("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
A = []
A.append([0, 0, 0])
for i in range(n):
    A.append([int(i) for i in input().split()])
ans = 'Yes'

for i in range(n - 1):
    dist = abs(A[i][1] - A[i + 1][1]) + abs(A[i][2] - A[i + 1][2])
    if (A[i + 1][0] - dist) % 2 == 1:
        ans = 'No'
        break
    
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if not( t >= x+y and t%2 == x+y%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( t >= x+y and t%2 == x+y%2):
        print('NO')
        exit()
print('YES')

Submission status: Wrong Answer

Solution code:
import sys
input()
pt, px, py = 0, 0, 0
for e in sys.stdin:
    ct, cx, cy = map(int, e.split())
    d = (ct - pt) - abs(cx - px) - abs(cy - py)
    if d < 0 or d % 2 == 1:
        print('No')
        break
    pt, px, py = ct, cx, cy
print('Yes')

Submission status: Wrong Answer

Solution code:
t1, x1, y1 = [0, 0, 0]
YN = "Yes"
for i in range(int(input())):
    t2, x2, y2 = [int(i) for i in input().split()]
    t = (t2 - t1)
    l = (abs(x2 - x1) + abs(y2 - y1))
    if l > t or (t % 2 == 0 and l % 2 != 0):
        YN = "No"
    t1, x1, y1 = t2, x2, y2
print(YN)

Submission status: Wrong Answer

Solution code:
t1, x1, y1 = [0, 0, 0]
YN = "Yes"
for i in range(int(input())):
    t2, x2, y2 = [int(i) for i in input().split()]
    t = (t2 - t1)
    l = (abs(x2 - x1) + abs(y2 - y1))
    if l > t or (t % 2 == 0 and l % 2 == 0):
        YN = "No"
    t1, x1, y1 = t2, x2, y2
print(YN)

Submission status: Wrong Answer

Solution code:
t1, x1, y1 = [0, 0, 0]
YN = "Yes"
for i in range(int(input())):
    t2, x2, y2 = [int(i) for i in input().split()]
    t = (t2 - t1) % 2 == 0
    l = (abs(x2 - x1) + abs(y2 - y1)) % 2 == 0
    if l > t or (t and l):
        YN = "No"
    t1, x1, y1 = t2, x2, y2
print(YN)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [input().split() for _ in range(n)]
ot = ox = oy = 0
for (t, x, y) in l:
    diff = int(t) - ot
    if 0 < abs(int(x) - ox) + abs(int(y) - oy) <= diff:
        ox = int(x)
        oy = int(y)
        ot = int(t)
    else:
        print("No")
        exit(0)
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [input().split() for _ in range(n)]
ot = ox = oy = 0
for (t, x, y) in l:
    diff = int(t) - ot
    if abs(int(x) - ox) + abs(int(y) - oy) <= diff:
        ox = int(x)
        oy = int(y)
        ot = int(t)
    else:
        print("No")
        exit(0)
print("Yes")

Submission status: Wrong Answer

Solution code:
def movement(x0, y0 , t, x1, y1) :
    total = abs(x1 - x0) + abs(y1 - y0)
    if total <= t and (t - total) % 2 == 0 :
        return "Yes"
    else :
        return "No"

n = int(input())
plan = []
x0, y0 = 0, 0


for i in range(n) :
    plan.append(list(map(int, input().split(" "))))
    if i > 0 :
      plan[i][0] -= plan[i-1][0]

for i in range(n) :
    judge = movement(x0, y0, plan[i][0], plan[i][1], plan[i][2])
    if judge == "Yes" :
        x0, y0 = plan[i][1], plan[i][2]
    else :
        print(judge)
        break

if x0 == plan[n-1][1] and y0 == plan[n-1][2] :
    print("Yes")

Submission status: Wrong Answer

Solution code:
def movement(x0, y0 , t, x1, y1) :
    total = abs(x1 - x0) + abs(y1 - y0)
    if total > t :
        return "No"
    elif (t - total) % 2 == 0 :
        return "Yes"
    else :
        return "No"

n = int(input())
plan = []
x0, y0 = 0, 0


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

for i in range(n) :
    judge = movement(x0, y0, plan[i][0], plan[i][1], plan[i][2])
    if judge == "Yes" :
        x0, y0 = plan[i][1], plan[i][1]
    else :
        print(judge)
        break

if x0 == plan[n-1][1] and y0 == plan[n-1][2] :
    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())
possible = True
for _ in range(n):
    t, x, y = map(int, input().split())
    if t < (x + y):
        if (x + y) % 2 != t % 2:
            possible = False
            break
    elif t % (x + y) != 0:
        possible = False
        break
if possible:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
possible = True
for _ in range(n):
    t, x, y = map(int, input().split())
    if t < (x + y):
        possible = False
        break
    elif t % (x + y) != 0:
        possible = False
        break
if possible:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

can = True
for i in range(N):
    dt, dist = 0, 0
    dt = points[i + 1][0] - points[i][0]
    dist = abs(points[i + 1][1] - points[i][1]) + abs(points[i + 1][2] - points[i][2])
    if dt < dist:
        can = False
    if dist % 2 != dt % 2:
        can = False

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

Submission status: Wrong Answer

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

can = True
for i in range(N):
    dt, dist = 0, 0
    dt = points[i + 1][0] - points[i][0]
    print(str(points[i][0]) + "," + str(points[i][1]))
    dist = abs(points[i + 1][1] - points[i][1]) + abs(points[i + 1][2] - points[i][2])
    if dt < dist:
        can = False
    if dist % 2 != dt % 2:
        can = False

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

Submission status: Wrong Answer

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

can = True
for i in range(N):
    dt = points[i + 1][0] - points[i][0]
    dist = abs(points[i + 1][0] - points[i][0]) \
           + abs(points[i + 1][0] - points[i][0])
    if dt < dist:
        can = False
    if dist % 2 != dt % 2:
        can = False
if can:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

for i in range(1,N+1):
    if abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) > abs(txy[i][0] - txy[i-1][0]):
        print("No")
        exit()
    if txy[i][1] == txy[i-1][1] and txy[i][2] == txy[i-1][2]:
        if (txy[i][0] - txy[i-1][0]) % 2 != 0:
            print("No")
            exit()

    if (txy[i][0] - txy[i-1][0]) % 2 == 0:
        if abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) % 2 != 0:
            print("No")
            exit()
    else:
        if (abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) )% 2 == 0:
            print("No")
            exit()

print("Yes")

Submission status: Wrong Answer

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

for i in range(1,N+1):
    if abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) > abs(txy[i][0] - txy[i-1][0]):
        print("No")
        exit()
    if txy[i][1] == txy[i-1][1] and txy[i][2] == txy[i-1][2]:
        if (txy[i][0] - txy[i-1][0]) % 2 != 0:
            print("No")
            exit()

    if (txy[i][0] - txy[i-1][0]) % 2 == 0:
        if abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) % 2 != 0:
            print("No")
            exit()
    else:
        if (abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) )% 2 == 0:
            print("No")
            exit()

Submission status: Wrong Answer

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

for i in range(1,N+1):
    if abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) > abs(txy[i][0] - txy[i-1][0]):
        print("No")
        exit()
    if (txy[i][0] - txy[i-1][0]) % 2 == 0:
        if abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) % 2 != 0:
            print("No")
            exit()
    else:
        if (abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) )% 2 == 0:
            print("No")
            exit()

print("Yes")

Submission status: Wrong Answer

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

for i in range(1,N+1):
    if abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) > abs(txy[i][0] - txy[i-1][0]):
        print("No")
        exit()
    elif txy[i][1] == txy[i-1][1] and txy[i][2] == txy[i-1][2]:
        if (txy[i][0] - txy[i-1][0]) % 2 != 0:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

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

for i in range(1,N+1):
    if (txy[i][1] - txy[i-1][1])**2 + (txy[i][2] - txy[i-1][2])**2 > (txy[i][0] - txy[i-1][0])**2:
        print("No")
        exit()
    elif txy[i][1] == txy[i-1][1] and txy[i][2] == txy[i-1][2]:
        if (txy[i][0] - txy[i-1][0]) % 2 != 0:
            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==1:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
for i in range(n):#h:高さ
    s.append([int(m) for m in input().split()])

for i in range(n):
    if i == 0:
        if not(-s[i][1] - s[i][0] <= s[i][2] <= -s[i][1] + s[i][0] and s[i][1] - s[i][0] <= s[i][2] <= s[i][1] + s[i][0]):
            print("No")
            exit()
        else:
            if (s[i][0] % 2 == 0 and (s[i][1] + s[i][2]) % 2 != 0) or (s[i][0] % 2 != 0 and (s[i][1] + s[i][2]) % 2 == 0):
                print("No")
                exit()
    else:
        if not(-s[i][1] + s[i - 1][1] + s[i - 1][2] - (s[i][0] - s[i - 1][0]) <= s[i][2] <= -s[i][1] + s[i - 1][1] + s[i - 1][2] + (s[i][0] - s[i - 1][0])\
            and s[i][1] + s[i - 1][1] - s[i - 1][2] - (s[i][0] - s[i - 1][0]) <= s[i][2] <= s[i][1] + s[i - 1][1] - s[i - 1][2] + (s[i][0] - s[i - 1][0])):
            print("No")
            exit()
        else:
            if (s[i][0] % 2 == 0 and (s[i][1] + s[i][2]) % 2 != 0) or (s[i][0] % 2 != 0 and (s[i][1] + s[i][2]) % 2 == 0):
                print("No")
                exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
for i in range(n):#h:高さ
    s.append([int(m) for m in input().split()])

for i in range(n):
    if i == 0:
        if not(0 - s[i][0] <= s[i][1] <= 0 + s[i][0]) or not(0 - s[i][0] <= s[i][2] <= 0 + s[i][0]):
            print("No")
            exit()
        else:
            if (s[i][0] % 2 == 0 and (s[i][1] + s[i][2]) % 2 != 0) or (s[i][0] % 2 != 0 and (s[i][1] + s[i][2]) % 2 == 0):
                print("No")
                exit()
    else:
        if not(s[i][1] - (s[i][0] - s[i - 1][0]) <= s[i][1] <= s[i][1] + (s[i][0] - s[i - 1][0])) or not(s[i][2] - (s[i][0] - s[i - 1][0]) <= s[i][2] <= s[i][2] + (s[i][0] - s[i - 1][0])):
            print("No")
            exit()
        else:
            if (s[i][0] % 2 == 0 and (s[i][1] + s[i][2]) % 2 != 0) or (s[i][0] % 2 != 0 and (s[i][1] + s[i][2]) % 2 == 0):
                print("No")
                exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
R = 0
T = 0
result = "Yes"
for i in range(N):
	t, x, y = map(int, input().split())
	r = x + y
	if r - t %2 == 1:
		result = "No"
#		break
	elif t - T < r - R:
		result = "No"
#		break
	else:
		R = r
		T = t
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
R = 0
T = 0
result = "Yes"
for i in range(N):
	t, x, y = map(int, input().split())
	r = x + y
	if r - t %2 == 1:
		result = "No"
		break
	elif t - T < r - R:
		result = "No"
		break
	else:
		R = r
		T = t
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())

flag = True
t0 = x0 = y0 = 0
for i in range(N):
    t1, x1, y1 = map(int, input().split())
    t = t1 - t0
    x = x1 - x0
    y = y1 - y0
    if t % (abs(x) + abs(y)) != 0: flag = False

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

Submission status: Wrong Answer

Solution code:
start = [0,0,0]
time = 0
t = int(input())
time_place = []
tf = [1]
for i in range(t):
    x = input().split()
    #print(abs(start[1] - int(x[1])),abs(start[2] - int(x[2])),int(x[0]) - time)
    if abs(start[1] - int(x[1])) + abs(start[2] - int(x[2])) <=  int(x[0]) - time and abs(start[1] - int(x[1])) + abs(start[2] - int(x[2])) % 2 == (int(x[0]) - time) % 2 :
        tf.append(1)
        time = int(x[0])
        start[1] = int(x[1])
        start[2] = int(x[2]) 
    else :
        tf.append(0)
        break
y = 1
for xx in tf :
    y *= xx
if y == 1 :
    print("Yes")
else :
    print("No")

Submission status: Wrong Answer

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

for j in range(N):
    if t-T>=abs(X-x)+abs(Y-y):
        if ((t-T)-(abs(X-x)+abs(Y-y)))%2==0:
            pass
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
    T=t
    X=x
    Y=y
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
t_, x_, y_ = 0, 0, 0
flag = 1
for i in range(n):
    t, x, y = map(int, input().split())
    t__ = t- t_
    x__ = x- x_
    y__ = y- y_
    if x__ + y__ % 2 != t__ % 2:
        flag = 0
    else:
        if abs(x) + abs(y) > t:
            flag = 0
    t_ = t
    x_ = x
    y_ = y

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