Problem:


Score : 300 points

Problem Statement

AtCoDeer the deer is going on a trip in a two-dimensional plane.
In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.

If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).
Note that he cannot stay at his place.
Determine whether he can carry out his plan.

Constraints

1 ≤ N ≤ 10^5

0 ≤ x_i ≤ 10^5

0 ≤ y_i ≤ 10^5

1 ≤ t_i ≤ 10^5

t_i < t_{i+1} (1 ≤ i ≤ N-1)

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N

Output

If AtCoDeer can carry out his plan, print Yes; if he cannot, print No.

Sample Input 1

2
3 1 2
6 1 1

Sample Output 1

Yes

For example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).

Sample Input 2

1
2 100 100

Sample Output 2

No

It is impossible to be at (100,100) two seconds after being at (0,0).

Sample Input 3

2
5 1 1
100 1 1

Sample Output 3

No



Sample input:
2
3 1 2
6 1 1


Sample output:
Yes

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
t = []
x = []
y = []
ok = True #ok

for i in range(0,n):
    tin, xin, yin = (int(i) for i in input().split())
    t.append(tin)
    x.append(xin)
    y.append(yin)

for i in range(1,n):
    TimeGap = t[i]-t[i-1]
    DisGap = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if TimeGap%2 != DisGap%2 or TimeGap < DisGap:
        ok = False
if ok == True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
t = []
x = []
y = []
ok = True #ok

for i in range(0,n):
    tin, xin, yin = (int(i) for i in input().split())
    t.append(tin)
    x.append(xin)
    y.append(yin)

for i in range(1,n):
    TimeGap = t[i]-t[i-1]
    DisGap = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if TimeGap%2 != DisGap%2 or TimeGap <= DisGap:
        ok = False
if ok == True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
t = []
x = []
y = []
ok = True #ok

for i in range(0,n):
    tin, xin, yin = (int(i) for i in input().split())
    t.append(tin)
    x.append(xin)
    y.append(yin)

for i in range(1,n):
    TimeGap = t[i]-t[i-1]
    DisGap = x[i]-x[i-1] + y[i]-y[i-1]
    if TimeGap%2 != DisGap%2 or TimeGap <= DisGap:
        ok = False
if ok == True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
t = []
x = []
y = []
ok = True #ok

for i in range(0,n):
    tin, xin, yin = (int(i) for i in input().split())
    t.append(tin)
    x.append(xin)
    y.append(yin)

for i in range(1,n):
    TimeGap = t[i]-t[i-1]
    DisGap = x[i]-x[i-1] + y[i]-y[i-1]
    if TimeGap%2 != DisGap%2 or TimeGap < DisGap:
        ok = False
if ok == True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
m=0
for i in range(n):
	[t,x,y]=map(int,raw_input().split())
	if t%(x+y)==0:
		m=m+1
		
if n==m:
	print 'Yes'
else:
	print 'No'

Submission status: Wrong Answer

Solution code:
n=int(input())
travel=[]
dif=[]
current=0
for i in range(n):
    travel.append(list(map(int,input().split())))
    dif.append(travel[-1][0]-current)
    current=travel[-1][0]
    
   
current=[0,0]
tamam=True
for i in range(n):
    need=abs(travel[i][1]-current[0])+abs(travel[i][2]-current[1])
    current=[travel[i][1],travel[i][2]]
    
    if dif[i] < need :
        tamam = False
        break
    elif (dif[i] - need) % 2 != 0 :
        tamam = False 
        break
if tamam :
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input())
t_bef = 0
x_bef = 0
y_bef = 0

flag = False
for i in range(N):
    t, x, y = map(int, input().split())
    t_diff = t - t_bef
    dist = abs(x - x_bef) + abs(y - y_bef)
    print(dist)
    if (t_diff - dist)%2 != 0 or dist > t_diff:
        flag = True
    else:
        t_bef = t
        x_bef = x
        y_bef = y

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

Submission status: Wrong Answer

Solution code:
N=int(input())

t_now=0
x_now=0
y_now=0

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]=map(int,list(input().split()))

for i in range (N):
    if((abs(x[i]-x_now)+abs(y[i]-y_now)>abs(t[i]-t_now)) or ((abs(t[i]-t_now)-(abs(x[i]-x_now)+abs(y[i]-y_now)))%2!=0) ):
        print("No")
        exit(0)
    else:
        x_now=x[i]
        y_now=y[i]
        t_now+=t[i]

print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())

t_now=0
x_now=0
y_now=0

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]=map(int,list(input().split()))

for i in range (N):
    if((abs(x[i]-x_now)+abs(y[i]-y_now)>abs(t[i]-t_now)) or (abs(x[i]-x_now)+abs(y[i]-y_now)==0 and abs(t[i]-t_now)%2!=0 ) ):
        print("No")
        exit(0)
    else:
        x_now=x[i]
        y_now=y[i]
        t_now+=t[i]

print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())

t_before=0
x_before=0
y_before=0
import sys

for i in range (N):
    t, x, y =map(int,input().split())
    t_diff=t-t_before
    distance=abs(x-x_before)+abs(y-y_before)
    if (t_diff-distance)%2!=0:
        print("No")
        sys.exit()
    else:
        t_before=t
        x_before=x
        y_before=y
        

print ("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())

t_before=0
x_before=0
y_before=0
import sys

for i in range (N):
    t, x, y =map(int,input().split())
    t_diff=t-t_before
    distance=abs(x-x_before)+abs(y-y_before)
    if (t_diff-distance)%2!=0:
        print("No")
        sys.exit()

print ("Yes")

Submission status: Wrong Answer

Solution code:
import sys

m = int(input())
t = []
x = []
y = []

i = 0
while(i < m):
  a = input().split()
  t.append(int(a[0]))
  x.append(int(a[1]))
  y.append(int(a[2]))
  i += 1

cx = 0
cy = 0

i = 0
while(i < m):
  dx = abs(x[i] - cx)
  dy = abs(y[i] - cy)
  dt = t[i] - (dx + dy)
  if(dt < 0 or dt > 0 and dt % 2 == 0):
    print('No')
    sys.exit()
  cx = x[i]
  cy = y[i]
  i += 1
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
X = []
temp = []

for i in range(N):
    X.append([int(i) for i in input().split()])

for i in X:
    if temp == []:
        if i[0] % 2 == 0 and (i[1] + i[2]) % 2 == 1:
            print("No")
            break
        elif i[0] % 2 == 1 and (i[1] + i[2]) % 2 == 0:
            print("No")
            break
        else:
            if i[1] + i[2] <= i[0]:
                print("Yes")
                break
            else:
                print("No")
                break
    else:
        if (i[0]-temp[0]) % 2 == 0 and (abs(i[1]-temp[1])+abs(i[2]-temp[2])) % 2 == 1:
            print("No")
            break
        elif (i[0]-temp[0]) % 2 == 1 and (abs(i[1]-temp[1])+abs(i[2]-temp[2])) % 2 == 0:
            print("No")
            break
        else:
            if abs(i[1]-temp[1])+abs(i[2]-temp[2]) <= i[0]-temp[0]:
                print("Yes")
                break
            else:
                print("No")
                break
    temp = i

Submission status: Wrong Answer

Solution code:
N = int(input())
X = []
temp = []

for i in range(N):
    X.append([int(i) for i in input().split()])

for i in X:
    if temp == []:
        if i[0] % 2 == 0 and (i[1] + i[2]) % 2 == 1:
            print("No")
            break
        elif i[0] % 2 == 1 and (i[1] + i[2]) % 2 == 0:
            print("No")
            break
        else:
            if i[1] + i[2] < i[0]:
                print("Yes")
                break
            else:
                print("No")
                break
    else:
        if (i[0]-temp[0]) % 2 == 0 and (abs(i[1]-temp[1])+abs(i[2]-temp[2])) % 2 == 1:
            print("No")
            break
        elif (i[0]-temp[0]) % 2 == 1 and (abs(i[1]-temp[1])+abs(i[2]-temp[2])) % 2 == 0:
            print("No")
            break
        else:
            if abs(i[1]-temp[1])+abs(i[2]-temp[2]) < i[0]-temp[0]:
                print("Yes")
                break
            else:
                print("No")
                break
    temp = i

Submission status: Wrong Answer

Solution code:

r = 1
t = 0
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])


for i in txy:
    t = i[0] - t

    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
            
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
    
    if r == N and t >= i[1] + i[2]:
        print("Yes")
        break
    else:
        print("No")
        break
    r += 1

Submission status: Wrong Answer

Solution code:

r = 1
t = 0
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])


for i in txy:
    t = i[0] - t

    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
            
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
    
    if r == N and t >= i[1] + i[2]:
        print("Yes")
        break
    else:
        print("No")
    r += 1

Submission status: Wrong Answer

Solution code:

r = 1
t = 0
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])


for i in txy:
    t = i[0] - t

    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
            
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
    
    if r == N and t > i[1] + i[2]:
        print("Yes")
        break
    r += 1

Submission status: Wrong Answer

Solution code:

r = 1
t = 0
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])


for i in txy:
    t = i[0] - t

    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
            
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
    
    if r == N and t >= i[1] + i[2]:
        print("Yes")
        break
    r += 1

Submission status: Wrong Answer

Solution code:

r = 1
t = 0
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])


for i in txy:
    t = i[0] - t

    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0 or t < i[1] + i[2]:
            print("No")
            break
    else:
        if (i[1] + i[2]) % 2 != 1 or t < i[1] + i[2]:
            print("No")
            break
    
    if r == N and t >= i[1] + i[2]:
        print("Yes")
        break
    r += 1

Submission status: Wrong Answer

Solution code:

r = 1
t = 0
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])


for i in txy:
    t = i[0] - t

    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
    
    if r == N and t >= i[1] + i[2]:
        print("Yes")
        break
    r += 1

Submission status: Wrong Answer

Solution code:

r = 1
t = 0
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])


for i in txy:
    t = i[0] - t

    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0 or (i[1] + i[2]) > t:
            print("No")
            break
    else:
        if (i[1] + i[2]) % 2 != 1 or (i[1] + i[2]) > t:
            print("No")
            break
    
    if r == N:
        print("Yes")
        break
    r += 1

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 25 13:22:12 2018

@author: tsumura
"""

r = 1
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])
    

for i in txy:
    if i[0] == 2:
        if (i[1] + i[2]) != 2 and (i[1] + i[2]) != 0:
            print("No")
            break

    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
    if r == N:
        print("Yes")
        break
    r += 1

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 25 13:22:12 2018

@author: tsumura
"""

r = 1
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])
    

for i in txy:
    if i[0] == 2:
        if (i[1] + i[2]) != 2 or (i[1] + i[2]) != 0:
            print("No")
            break
    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
    if r == N:
        print("Yes")
        break
    r += 1

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 25 13:22:12 2018

@author: tsumura
"""

r = 1
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])
    

for i in txy:
    if i[0] == 2:
        if (i[1] + i[2]) != 2:
            print("No")
            break
    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
    if r == N:
        print("Yes")
        break
    r += 1

Submission status: Wrong Answer

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

can = True
for i in range(n):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[1])
    if dist > dt:
        can = False
    elif (dist%2) != (dt%2):
        can = False
if can:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

can = True
for i in range(n):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[1])
    if dist > dt:
        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())
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())
for i in range(n):
    t, x, y = map(int, input().split())
    if x+y>t or (x+y-t)%2 !=0:
        print('NO')
        exit()
print('YES')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

n = int(input())
t_bef, x_bef, y_bef, flag = 0, 0, 0, 0
travel = []
for i in range(n):
    travel.append([int(x) for x in input().split()])

for j in travel:
    t, x, y = j[0], j[1], j[2]
    check = (t - t_bef) - abs(x_bef - x) - abs(y_bef - y)
    t_bef, x_bef, y_bef = t, x, y
    if check < 0:
        print('No')
        flag = 1
        break
    if check % 2 != 0:
        print('No')
        flag = 1
        break
if flag == 0:
    print('YES')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

n = int(input())
t_bef = 0
x_bef = 0
y_bef = 0
flag = 0
for i in range(n):
    t, x, y = [int(x) for x in input().split()]
    check = (t - t_bef) - abs(x_bef - x) - abs(y_bef - y)
    t_bef, x_bef, y_bef = t, x, y
    if check < 0:
        print('No')
        flag = 1
        break
    if check % 2 != 0:
        print('No')
        flag = 1
        break
if flag == 0:
    print('YES')

Submission status: Wrong Answer

Solution code:
# 動けるかどうかの判定
def movable(prev_loc, loc):
  dt = loc[0] - prev_loc[0]
  dx = abs(loc[1] - prev_loc[1])
  dy = abs(loc[2] - prev_loc[2])
  # 時間内に届かない
  if dx + dy > dt:
    return False
  if dx + dy % 2 == dt % 2:
    return True
  else:
    return False

# 入力
n = int(input())
loc_list = []
for _ in range(n):
  loc_list.append(list(map(int, input().split())))

# 処理
ans = True
prev_loc = [0, 0, 0]
for loc in loc_list:
  # 現在の位置から次の位置へ移動可能かどうかを判定
  if not movable(prev_loc, loc):
    ans = False
    break
  prev_loc = loc

if ans:
  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:
def BlCannotGo(dt, dx, dy): ## 行けないならTrue
    dist = dx + dy
    if (dt % 2) != (dist % 2) or dist > dt:
        return True
    else:
        return False

def abs(x):
    if x>=0:
        return x
    else:
        return -x

if __name__ == '__main__':
    n = int(input())
    t = list(False for _  in range(n+1))
    x = list(False for _  in range(n+1))
    y = list(False for _  in range(n+1))
    t[0], x[0], y[0] = 0, 0, 0
    for i in range(n):
        t[i+1], x[i+1], y[i+1] = map(int, input().split())

    for i in range(1,n+1):
        dt = t[i] -  t[i-1]
        dx = abs(x[i] -  x[i-1])
        dy = abs(y[i] -  y[i-1])
        if BlCannotGo(dt, dx, dy):
            print('NO')    
            exit()

    print('YES')

Submission status: Wrong Answer

Solution code:
def BlCannotGo(dt, dx, dy): ## 行けないならTrue
    if (dt % 2) != ((dx + dy) % 2) or (dx + dy) > dt:
        return True
    else:
        return False

if __name__ == '__main__':
    n = int(input())
    l = list(list(map(int, input().split())) for _ in range(n))

    dt = l[0][0]
    dx = l[0][1]
    dy = l[0][2]
    if BlCannotGo(dt, dx, dy):
        print('NO')    
        exit()
        
    for i in range(1,n):
        dt = l[i][0] -  l[i-1][0] 
        dx = abs(l[i][1] -  l[i-1][1])
        dy = abs(l[i][2] -  l[i-1][2])
        if BlCannotGo(dt, dx, dy):
            print('NO')    
            exit()

    print('YES')

Submission status: Wrong Answer

Solution code:
def BlCannotGo(dt, dx, dy): ## 行けないならTrue
    if (dt % 2) != ((dx + dy) % 2) or (dx + dy) > dt:
        return True
    else:
        return False

if __name__ == '__main__':
    n = int(input())
    l = list(list(map(int, input().split())) for _ in range(n))

    dt = l[0][0]
    dx = l[0][1]
    dy = l[0][2]
    if BlCannotGo(dt, dx, dy):
        print('NO')    
        exit()
        
    for i in range(1,n):
        dt = l[i][0] -  l[i-1][0] 
        dx = l[i][1] -  l[i-1][1]
        dy = l[i][2] -  l[i-1][2]
        if BlCannotGo(dt, dx, dy):
            print('NO')    
            exit()

    print('YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
txys = [list(map(int, input().split())) for _ in range(N) ]
txys.insert(0, [0, 0, 0])
 
for i in range(N):
    dt = txys[i][0] - txys[i+1][0]
    dist = abs(txys[i][1] - txys[i+1][1]) + abs(txys[i][2] - txys[i+1][2])
    if dt % 2 != dist % 2 or dist > dt:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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

for i in range(N):
    a,b,c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)
i = 0
flag = True
while i < N:
    time = t[i]-t[i-1]
    dis = abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    if time<dis:
        flag = False
        break
    elif (time%2+ dis%2) == 1:
            flag = False
            break
    i += 1

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

Submission status: Wrong Answer

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

for i in range(N):
    a,b,c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)
i = 0
flag = True
while i < N:
    time = t[i]-t[i-1]
    dis = abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    if time>=dis:
        if (time%2+ dis%2) == 1:
            flag = False
            break
    i += 1

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

Submission status: Wrong Answer

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

for i in range(N):
    a,b,c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)
i = 0
flag = True
while i < N:
    time = t[i]-t[i-1]
    dis = (x[i]-x[i-1])+(y[i]-y[i-1])
    if time>=dis:
        if (time%2+ dis%2) == 1:
            flag = False
            break
    i += 1

if flag == True:
    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) % 2 != t % 2:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

x = 0
y = 0
t = 0
do = True
for i in range(0, n):
 z = raw_input().split(" ")
 nt = int(z[0])
 nx = int(z[1])
 ny = int(z[2])
 dt = nt - t
 dx = nx - x
 dy = ny - y
 t = nt
 x = nx
 y = ny
 
 if (dx+dy)%2 != (dt)%2:
  print 1
  do = False
  break
 if abs(dx)+abs(dy) > abs(dt):
  print 2
  do = False
  break
if do:
 print "Yes"
else:
 print "No"

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

x = 0
y = 0
t = 0
do = True
for i in range(0, n):
 z = raw_input().split(" ")
 nt = int(z[0])
 nx = int(z[1])
 ny = int(z[2])
 dx = nx - x
 dy = ny - y
 dt = nt - t
 x = nx
 y = ny
 t = nt
 
 if (dx+dy)%2 != (dt)%2:
  print 1
  do = False
  break
 if abs(dx+dy) > dt:
  print 2
  do = False
  break
if do:
 print "Yes"
else:
 print "No"

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

x = 0
y = 0
t = 0
do = True
for i in range(0, n):
 z = raw_input().split(" ")
 nt = int(z[0])
 nx = int(z[1])
 ny = int(z[2])
 dx = nx - x
 dy = ny - y
 dt = nt - t
 x = nx
 y = ny
 t = nt
 
 if (dx+dy)%2 != (dt)%2:
  print 1
  do = False
  break
 if (dx+dy) > dt:
  print 2
  do = False
  break
if do:
 print "Yes"
else:
 print "No"

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
t = x = y = 0
for x in range(N):
    nt, nx, ny = map(int, input().split())
    dt = nt - t
    dxy = abs(nx - x) + abs(ny - y)
    if dxy > dt or (dxy - dt) % 2 == 1:
        print("No")
        sys.exit()
    t = nt
    x = nx
    y = ny
print("Yes")

Submission status: Wrong Answer

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

t = [0] + [col[0] for col in grid]
xs = [0] + [col[1] for col in grid]
ys = [0] + [col[2] for col in grid]

res = 'Yes'
for i in range(N):
    interval = t[i+1] - t[i]
    x_dist = xs[i+1] - xs[i]
    y_dist = ys[i+1] - ys[i]
    if x_dist > interval or y_dist > interval:
        res = 'No'
        break

print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = [list(map(lambda x:int(x),input().split())) for i in range(n)]
ok = True
for i in range(n-1):
    mo = (li[i+1][2] - li[i][2]) + (li[i+1][1] - li[i][1])
    ti = li[i+1][0] - li[i][0]
    if (mo%2)!=(ti%2) or mo>ti or ((mo!=0 or ti != 0) and (mo==0 or ti == 0)):
        ok = False
mo = (li[0][2] - 0) + (li[0][1] - 0)
ti = li[0][0] -0
if (mo%2)!=(ti%2) or mo>ti or ((mo!=0 or ti != 0) and (mo==0 or ti == 0)):
    ok = False
if ok :
    print("Yes")
else :
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
li = [list(map(lambda x:int(x),input().split())) for i in range(n)]
ok = False
for i in range(n-1):
    mo = (li[i+1][2] - li[i][2]) + (li[i+1][1] - li[i][1])
    ti = li[i+1][0] - li[i][0]
    if (mo%2)==(ti%2) and mo<=ti and ((mo==0 and ti == 0) or (mo!=0 and ti != 0)):
        ok = True
if ok :
    print("Yes")
else :
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
li = [list(map(lambda x:int(x),input().split())) for i in range(n)]
ok = False
for i in range(n-1):
    mo = (li[i+1][2] - li[i][2]) + (li[i+1][1] - li[i][1])
    ti = li[i+1][0] - li[i][0]
    if (mo%2)==(ti%2) and mo<=ti:
        ok = True
if ok :
    print("Yes")
else :
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
travel = [map(int, raw_input().split()) for i in range(n)]

accessible_now = [(0,0)]
limit = 1e5 + 1

stroke = 0
for target in travel:
  t, x, y = target
  while (stroke<t):
    stroke += 1
    accessible_next = [] 
    for loc in accessible_now:
      for step in [(1,0),(0,1),(-1,0),(0,-1)]:
        loc_next = (loc[0]+step[0],loc[1]+step[1])
        if ((-1 in loc_next) or (limit in loc_next)):
          continue
        if (loc_next in accessible_next):
          continue
        accessible_next.append(loc_next)
    accessible_now = accessible_next
    print stroke, t, accessible_now
    if (stroke == t):
      if ((x,y) in accessible_now):
        continue
      else:
        print 'No'
        exit(0) 
res = 'Yes' if (stroke==t) else 'No'
print res

Submission status: Wrong Answer

Solution code:
n = input()
pt = px = py = 0
for _ in xrange(n):
    t, x, y = map(int, raw_input().split())
    if abs(x-px)+abs(y-py) > t-pt:
        print "No"
        break
    if (x+y-px-py) % 2 ^ (t-pt) % 2 :
        print x+y-px-py % 2
        print t-pt % 2
        print "No"
        break
    pt = t
    px = x
    py = y
else:
    print "Yes"

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list()
for index in range(N):
	T.append((int(i) for i in input().split()))

pt, px, py = (0, 0, 0)
for t, x, y in T:
	d = (pt - t) - (abs(x - px) + abs(y - py))
	if d >= 0 and d % 2 == 0:
		pt, px, py = (t, x, y)
	else:
		print("No")
		exit(0)

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list()
for index in range(N):
	T.append((int(i) for i in input().split()))

pt, px, py = (0, 0, 0)
for t, x, y in T:
	d = (pt - t) - ((x - px) + (y - py))
	if d >= 0 and d % 2 == 0:
		pt, px, py = (t, x, y)
	else:
		print("No")
		exit(0)

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list()
for index in range(N):
	T.append((int(i) for i in input().split()))

pt, px, py = (0, 0, 0)
for t, x, y in T:
	d = ((x - px) + (y - py)) - (pt - t)
	if d >= 0 and d % 2 == 0:
		pt, px, py = (t, x, y)
	else:
		print("No")
		exit(0)

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list()
for index in range(N):
	T.append((int(i) for i in input().split()))

pt, px, py = (0, 0, 0)
for t, x, y in T:
	if t - pt == (x - px) + (y - py):
		pt, px, py = (t, x, y)
	else:
		print("No")
		exit(0)

print("Yes")

Submission status: Wrong Answer

Solution code:
import copy

n = int(input())
status = [0, 0, 0]
ans = "Yes"
for i in range(0, n):
    line = input().split(" ")
    a = list(map(int, line))
    if a[0] - status[0] < abs(a[1] - status[1]) + abs(a[2] - status[2]):
        ans = "No"
        break
    elif (abs(a[1] - status[1]) + abs(a[2] - status[2]) - a[0] + status[0]) % 2 != 0:
        ans = "No"
        break
    else:
        status=copy.deepcopy(a)
        status[0] = abs(a[1] - status[1]) + abs(a[2] - status[2])
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
status = [0, 0, 0]
ans = "Yes"
for i in range(0, n):
    line = input().split(" ")
    a = list(map(int, line))
    if a[0] - status[0] < abs(a[1] - status[1]) + abs(a[2] - status[2]):
        ans = "No"
        break
    elif (abs(a[1] - status[1]) + abs(a[2] - status[2]) - a[0] + status[0]) % 2 != 0:
        ans = "No"
        break
    else:
        status[0] = abs(a[1] - status[1]) + abs(a[2] - status[2])
        status[1] = a[1]
        status[2] = a[2]
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
G=[None for i in range(n)]
res = True
max = 0

def dps(d):
    global res
    P=[0,0,0]   #Pはt,x,yのリスト
    for i in range(d):
        if G[i] != None:
            gt,gx,gy = G[i]
            pt,px, py = P
            if gt-pt >= gx-px + gy-gx:
                if (gt-pt - (gx-px + gy-gx))%2 == 0:
                    res &=  True
                else:
                    res &= False
            else:
                res &= False
            P=G[i]
        else:
            res &= True
            
    

for i in range(n):
    t,x,y = map(int,input().split())
    if G[i]==None:
        G[i] = []
        G[i].append(t)
        G[i].append(x)
        G[i].append(y)
        dps(i+1)
    elif G[i]==[t,x,y]:
        dps(i+1)
    else:
        res = False
        break        
        
print('Yes' if res==False else 'No')

Submission status: Wrong Answer

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

import sys

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

for i in range(1, len(L)):
    t = L[i][0] - L[i-1][0]
    x = L[i][1] - L[i-1][1]
    y = L[i][2] - L[i-1][2]
    num = t - abs(x) - abs(y)
    if num < 0 or num % 2:
        print('No')
        sys.exit()
print('Yes')

Submission status: Wrong Answer

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

message = "Yes"
for i in range(len(l) - 1):
	t_delta = abs(l[i][0] - l[i + 1][0])
	x_delta = abs(l[i][1] - l[i + 1][1])
	y_delta = abs(l[i][2] - l[i + 1][2])
	t_minus_d = t_delta - x_delta - y_delta
	if (t_minus_d < 0) or (t_minus_d % 2 != 0):
		message = "No"
		break
print(message)

Submission status: Wrong Answer

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

message = "Yes"
for i in range(len(l) - 1):
	t_delta = abs(l[i][0] - l[i + 1][0])
	x_delta = abs(l[i][1] - l[i + 1][1])
	y_delta = abs(l[i][2] - l[i + 1][2])
	t_minus_d = t_delta - x_delta - y_delta
	if (t_minus_d < 0) or (t_minus_d % 2 != 0):
		message = "No"
		break
print(message)

Submission status: Wrong Answer

Solution code:
#-*- coding:utf-8 -*-
import math
import sys

t,x,y = [],[],[]
N = int(input())

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

for i in range(N-1):
	T = t[i+1]-t[i]
	Z = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
	if (T < Z) or ((T%2) != (Z%2)):
		print("No")
		sys.exit()
print("Yes")