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:
# author:  Taichicchi
# created: 27.09.2020 23:57:30

import sys

N = int(input())

t1, x1, y1 = 0, 0, 0

for i in range(N):
    t, x, y = map(int, input().split())
    dx = abs(x - x1)
    dy = abs(y - y1)
    dt = t - t1

    # print(f"{dt=}{dx=}{dy=}")

    if dx + dy > t:
        print("No")
        exit()

    if (dt - (dx + dy)) % 2 != 0:
        print("No")
        exit()

    t1, x1, y1 = t, x, y

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
now,nowx,nowy=0,0,0
out = "Yes"
for i in range(N):
    t,x,y = list(map(int,input().split()))
    D = abs(x-nowx)+abs(y-nowy)
    T = t-now
    if D<=T and T%2==D%2:
        continue
    else:
        out="No"
print(out)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
data = [list(map(int,input().split())) for _ in range(n)]
flg = 1

for i in range(n):
    t = data[i][0]
    x = data[i][1]
    y = data[i][2]
#t < xi+yiなら満たさない
#t == xi+yiなら最短経路となるので満たす
#t > xi+yiなら両辺の偶奇が一致すれば満たす
    if t < x+y:
        print('No')
        sys.exit()
    elif t == x+y:
        pass
    else:
        if (x+y) % 2 == t % 2:
            pass
        else:
            print('No')
            sys.exit()

if flg:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
data = [list(map(int,input().split())) for _ in range(n)]
flg = 1

for i in range(n):
    t = data[i][0]
    x = data[i][1]
    y = data[i][2]
    if t < x+y:
        print('No')
        sys.exit()
    elif t == x+y:
        pass
    else:
        if (x+y) % 2 == 0:
            if t % 2 == 0:
                pass
            else:
                print('No')
                sys.exit()
        else:
            if t % 2 == 1:
                pass
            else:
                print('No')
                sys.exit()
        
if flg:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
ans = True
prevt = 0
prevx = 0
prevy = 0
for _ in range(n):
    t, x, y = inm()
    totalt = t - prevt
    totald = abs(x - prevx) + abs(y - prevy)
    if totald > totalt or (totald % 2) != (totalt % 2):
        ans = False
        break
    prevt = t
    prevx = x
    prevy = y
print("YES" if ans else "NO")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
ans = True
prevt = 0
prevx = 0
prevy = 0
for _ in range(n):
    t, x, y = inm()
    totalt = t - prevt
    totald = abs(x - prevx) + abs(y - prevy)
    if totald > totalt or (totald % 2) != (totalt % 2):
        ans = False
        break
    prevt = t
    prevx = x
    prevy = y
print("Yes" if ans else "NO")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
ans = True
prevt = 0
prevx = 0
prevy = 0
for _ in range(n):
    t, x, y = inm()
    totalt = t - prevt
    totald = abs(prevx - x) + abs(prevy - y)
    if totald > totalt or totald % 2 != totalt % 2:
        ans = False
        break
    prevt = t
    prevx = x
    prevy = y
print("Yes" if ans else "NO")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
ans = True
prevt = 0
prevx = 0
prevy = 0
for _ in range(n):
    t, x, y = inm()
    totalt = t - prevt
    totald = abs(x - prevx) + abs(y - prevy)
    if totald > totalt or totald % 2 != totalt % 2:
        ans = False
        break
    prevt = t
    prevx = x
    prevy = y
print("Yes" if ans else "NO")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
ans = True
prevt = 0
prevx = 0
prevy = 0
for _ in range(n):
    t, x, y = inm()
    totalt = t - prevt
    totald = abs(x - prevx) + abs(y - prevy)
    if totald > totalt or totald % 2 != totalt % 2:
        ans = False
        break
print("Yes" if ans else "NO")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
ans = True
prevt = 0
prevx = 0
prevy = 0
for _ in range(n):
    t, x, y = inm()
    if (abs(x - prevx) + abs(y - prevy)) > (t - prevt) or (t - prevt) % 2 != ((abs(x - prevx) + abs(y - prevy)) % 2):
        ans = False
        break
    prevt = t
    prevx = x
    prevy = y
print("Yes" if ans else "NO")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
ans = True
prevt = 0
prevx = 0
prevy = 0
for _ in range(n):
    t, x, y = inm()
    if (abs(x - prevx) + abs(y - prevy)) > (t - prevt) or (t - prevt) % 2 != (abs(x - prevx) + abs(y - prevy)) % 2:
        ans = False
        break
    prevt = t
    prevx = x
    prevy = y
print("Yes" if ans else "NO")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
ans = True
for _ in range(n):
    t, x, y = inm()
    if x+y > t or t % 2 != (x+y) % 2:
        ans = False
        break
print("Yes" if ans else "NO")

Submission status: Wrong Answer

Solution code:
n=int(input())
t,x,y=0,0,0
for _ in range(n):
  nt,nx,ny=map(int,input().split())
  if (nx+ny-x-y)%2!=(nt-t)%2 or nx+ny-x-y>nt-t:
    print('No')
    break
  else:t,x,y=nt,nx,ny
else:print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
arr_t = [0]
arr_x = [0]
arr_y = [0]
flag = 0

for i in range(N):
  t, x, y = list(map(int, input().split()))
  arr_t.append(t)
  arr_x.append(x)
  arr_y.append(y)

for i in range(N):
  if arr_t[i+1]-arr_t[i] < arr_x[i+1]-arr_x[i]+arr_y[i+1]-arr_y[i]:
    flag = 1
  elif ((arr_t[i+1]-arr_t[i])-(arr_x[i+1]-arr_x[i])+(arr_y[i+1]-arr_y[i]))%2 == 0:
    flag = 0
  else:
    flag = 1

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

Submission status: Wrong Answer

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

pre = [0, 0, 0]
jdg = True
for t, x, y in txy:
    d = abs(x - pre[1]) + abs(y - pre[2])
    tt = t - pre[0]
    if tt - d >= 0 and (tt - d) % 2 == 0:
        jdg = True
    else:
        jdg = False
        break
        
print('Yes' if jdg else 'No')

Submission status: Wrong Answer

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

pre = [0, 0, 0]
jdg = True
for t, x, y in txy:
    d = x - pre[1] + y - pre[2]
    tt = t - pre[0]
    if tt - d >= 0 and (tt - d) % 2 == 0:
        jdg = True
    else:
        jdg = False
        break
        
print('Yes' if jdg else 'No')

Submission status: Wrong Answer

Solution code:
n=int(input())
txy=[input().split() for i in range(n)]
if n!=1:
  for i in range(n-1):
    subX=int(txy[i+1][1])-int(txy[i][1])
    subY=int(txy[i+1][2])-int(txy[i][2])
    subT=int(txy[i+1][0])-int(txy[i][0])
    t=[]
    p=subT-subX-subY
    t.append(p)
    s=[]
  for i in range(len(t)):
      if t[i]<0 or t[i]%2==1:
        s.append(t[i])
        if s==[]:
          print('Yes')
        else:
          print('No')
      
else:
  subby=int(txy[0][0])-int(txy[0][1])-int(txy[0][2])
  if subby>=0 and subby%2==0:
    print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
txy=[input().split() for i in range(n)]
if n!=1:
  for i in range(n-1):
    subX=int(txy[i+1][1])-int(txy[i][1])
    subY=int(txy[i+1][2])-int(txy[i][2])
    subT=int(txy[i+1][0])-int(txy[i][0])
    t=[]
    p=subT-subX-subY
    t.append(p)
  for i in range(len(t)):
      if t[i]<0 or t[i]%2==1:
        print('No')
      else:
        print('Yes')
else:
  subby=int(txy[0][0])-int(txy[0][1])-int(txy[0][2])
  if subby>=0 and subby%2==0:
    print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
txy=[input().split() for i in range(n)]
if n!=1:
  for i in range(n-1):
    subX=int(txy[i+1][1])-int(txy[i][1])
    subY=int(txy[i+1][2])-int(txy[i][2])
    subT=int(txy[i+1][0])-int(txy[i][0])
  if subT-subX-subY>=0 and (subT-subX-subY)%2==0:
    print('Yes')
  else:
    print('No')
else:
  subby=int(txy[0][0])-int(txy[0][1])-int(txy[0][2])
  if subby>=0 and subby%2==0:
    print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys

a,b = 0,0
for i in range(int(input())):
    t,x,y = map(int,input().split())
    dif = abs(x - a) + abs(y - b)
    if t % dif != 0:
        print("No")
        sys.exit()
    a,b = x,y
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
ti = [0] * (n-1)
xi = [0] * (n-1)
yi = [0] * (n-1)

P = 'Yes'


for i in range(n):
    tii, xii, yii = map(int, input().split())
    ti.append(tii)
    xi.append(xii)
    yi.append(yii)
    tc = ti[i-1] - ti[i]
    #dest = abs(xi[i]-xi[i-1]) - abs(yi[i]-yi[i-1])
    #if tc == abs(dest): pass
    if ti[i] != (xi[i]+yi[i]) or (xi[i]+yi[i]+ti[i]-ti[i-1])%2: P = 'No'

print(P)

Submission status: Wrong Answer

Solution code:
n = int(input())
ti = [0] * (n-1)
xi = [0] * (n-1)
yi = [0] * (n-1)

P = 'Yes'


for i in range(n):
    tii, xii, yii = map(int, input().split())
    ti.append(tii)
    xi.append(xii)
    yi.append(yii)
    tc = ti[i-1] - ti[i]
    dest = abs(xi[i]-xi[i-1]) - abs(yi[i]-yi[i-1])
    if tc == abs(dest): pass
    else: P = "No"
    if xi[i]==xi[i-1] & yi[i]==yi[i-1]: P ='No'

print(P)

Submission status: Wrong Answer

Solution code:
n = int(input())
ti = [0] * (n-1)
xi = [0] * (n-1)
yi = [0] * (n-1)

P = 'Yes'


for i in range(n):
    tii, xii, yii = map(int, input().split())
    ti.append(tii)
    xi.append(xii)
    yi.append(yii)
    tc = ti[i-1] - ti[i]
    dest = abs(xi[i]-xi[i-1]) - abs(yi[i]-yi[i-1])
    if tc == abs(dest): pass
    else: P = "No"

print(P)

Submission status: Wrong Answer

Solution code:
n = int(input())
ti = [0] * (n-1)
xi = [0] * (n-1)
yi = [0] * (n-1)

P = 'Yes'


for i in range(n):
    tii, xii, yii = map(int, input().split())
    ti.append(tii)
    xi.append(xii)
    yi.append(yii)
    tc = ti[i-1] - ti[i]
    dest = abs(xi[i]-xi[i-1]) - abs(yi[i]-yi[i])
    if tc == dest: pass
    else: P = "No"

print(P)

Submission status: Wrong Answer

Solution code:
n = int(input())
ti = [0] * (n-1)
xi = [0] * (n-1)
yi = [0] * (n-1)

P = 'Yes'


for i in range(n):
    tii, xii, yii = map(int, input().split())
    ti.append(tii)
    xi.append(xii)
    yi.append(yii)
    tc = ti[i-1] - ti[i]
    dest = abs(xi[i]-yi[i-1]) - abs(yi[i]-yi[i])
    if tc == dest: pass
    else: P = "No"

print(P)

Submission status: Wrong Answer

Solution code:
n = int(input())
ti = [0] * (n-1)
xi = [0] * (n-1)
yi = [0] * (n-1)

P = 'Yes'


for i in range(n):
    tii, xii, yii = map(int, input().split())
    ti.append(tii)
    xi.append(xii)
    yi.append(yii)
    tc = ti[i-1] - ti[i]
    dest = abs(xi[i-1]+yi[i-1]+xi[i]+yi[i])
    if tc == dest: pass
    else: P = "No"

print(P)

Submission status: Wrong Answer

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

def f(p1,p2):
  dt=abs((p2[1])-(p1[1]))+abs((p2[2])-(p1[2]))
  D=p2[0]-p1[0]
  if D>=dt:
    if (D%2==0 and dt%2==0) or (D%2==1 and dt%2==1):
      return True
    else:
      return False
  else:
    return False

result=[f(M[i],M[i+1]) for i in range(N)]

if all(result)==True:
  print('YES')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
x = 0
y = 0
t = 0
flag = True
for _ in range(N):
    new_t, new_x, new_y = [int(i) for i in input().split()]
    gap_t = new_t - t
    gap_x = new_x - x
    gap_y = new_y - y
    total_move = gap_x + gap_y
    if gap_t % 2 == 1:
        if total_move % 2 == 1:
            continue
        else:
            print("No")
            break
    else:
        if total_move  % 2 == 0:
            continue
        else:
            print("No")
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
last = [0,0,0]
for i in range(N):
    ti,xi,yi = map(int,input().split())
    a = ti-last[2] - abs(xi-last[0])+abs(yi-last[1])
    if a >= 0  and a % 2 == 0:
        flag = True
    else:
        flag = False
        break
    last = [xi,yi,ti]
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(n):
    a,b,c=map(int,input().split())
    if a%4!=(b+c)%4 or b+c>a:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[list(map(int,input().split()))for i in range(n)]
s.insert(0,[0,0,0])
p=0
for i in range(n):
    c=s[i+1][0]-s[i][0]
    d=abs(s[i+1][1]-s[i][1])+abs(s[i+1][2]-s[i][2])
    if c<=d or (c-d)%2==1:
        p=1
        break
print("No" if p==1 else "Yes")

Submission status: Wrong Answer

Solution code:
ans = 'Yes'
m = []
t_last = x_last = y_last = 0
N = int(input())
for i in range(0, N):
  m.append(list(map(int, input().split())))

for l in m:
  x_now = abs(x_last-l[1])
  y_now = abs(y_last-l[2])
  if(l[0]%(x_now+y_now) != 0 ):
    ans = 'No'
    break
  x_last=l[1]
  y_last=l[2]


print(ans)

Submission status: Wrong Answer

Solution code:
ans = 'Yes'
m = []
t_last = x_last = y_last = 0
N = int(input())
for i in range(0, N):
  m.append(list(map(int, input().split())))

for l in m:
  x_now = abs(l[1]-x_last)
  y_now = abs(l[2]-y_last)
  if(l[0]%(x_now+y_now) != 0 ):
    ans = 'No'
    break
  x_last=l[1]
  y_last=l[2]


print(ans)

Submission status: Wrong Answer

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

for l in m:
  if(l[0]%(l[1]+l[2]) != 0 ):
    ans = 'No'
    break

print(ans)

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):
    x_diff=abs(x[i]-x_now)
    y_diff=abs(y[i]-y_now)
    t_diif=abs(t[i]-t_now)
    if ((x_diff+y_now > t_diif) or (-(x_diff + y_diff) - t[i] - t_now) % 2 == 1):
        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):
    x_diff=abs(x[i]-x_now)
    y_diff=abs(y[i]-y_now)
    t_diif=abs(t[i]-t_now)
    if ((x_diff+y_now > t_diif) or ((-x_diff + y_diff-t[i] - t_now) % 2 == 1)):
        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):
    xy_diff=abs(x[i]-x_now)+abs(y[i]-y_now)
    t_diif=abs(t[i]-t_now)
    if((xy_diff>t_diif) or (xy_diff-t_diif%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):
    xy_diff=abs(x[i]-x_now)+abs(y[i]-y_now)
    t_diif=abs(t[i]-t_now)
    if((xy_diff>t_diif) or (xy_diff%2==0 and t_diif%2!=0) or (xy_diff!=2 and t_diif%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:
from collections import deque

num = int(input())

to_num = lambda x : [int(i) for i in input().split(' ')]

masume = {}
for i in range(num):
    line = to_num(1)
    for l in range(len(line)):
        masume[line[0]] = (line[1], line[2])

masume_deque = deque(list(masume.keys()))
pre_pos = (0, 0)
pre_times = 0
for index in range(num):
    k = masume_deque[index]
    cur_pos = masume[k]
    distance = sum([abs(cur_pos[i]-pre_pos[i]) for i in [0, 1]])
    times = abs(k - pre_times)
    if distance % 2 != times % 2 or distance > times:
        ans = False
        break
    else:
        ans = True
    pre_pos = cur_pos
    pre_times = masume_deque[i]
    
if ans:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import deque

num = int(input())

to_num = lambda x : [int(i) for i in input().split(' ')]

masume = {}
for i in range(num):
    line = to_num(1)
    for l in range(len(line)):
        masume[line[0]] = (line[1], line[2])

masume_deque = deque(list(masume.keys()))
pre_pos = (0, 0)
for index in range(len(masume_deque)):
    k = masume_deque[index]
    cur_pos = masume[k]
    distance = sum([abs(cur_pos[i]-pre_pos[i]) for i in [0, 1]])
    times = abs(k - masume_deque[index-1])
    if distance % 2 != times % 2 or distance > times:
        ans = False
        break
    else:
        ans = True
    pre_pos = cur_pos
    
if ans:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
def travel(xs,ys,xf,yf,t):
    d=abs(xf-xs)+abs(yf-ys)
    if d>t:
        return False
    else:
        if d%2==t%2:
            return True
        else:
            return False

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

for i in range(N-1):
    if travel(txy[i][1],txy[i][2],txy[i+1][1],txy[i+1][2],txy[i+1][0]-txy[i][0])==False:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
d = []

time = 0;_x = 0;_y = 0

for i in range(N):
    t, x, y = map(int, input().split())
    time = t - time
    dis = abs(_x - x) + abs(_y - y)
    if dis == time:
        time, _x, _y = time, x, y
    elif dis < time and (time - dis) % 2 == 0:
        _x = x;_y = y;time = time
    else:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
d = []

time = 0;_x = 0;_y = 0

for i in range(N):
    t, x, y = map(int, input().split())
    time = t - time
    dis = abs(_x - x) + abs(_y - y)
    if dis == time:
        _x = x;_y = y;time = time
    elif dis < time and (time - dis) % 2 == 0:
        _x = x;_y = y;time = time
    else:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
d = []

time = 0;_x = 0;_y = 0

for i in range(N):
    t, x, y = map(int, input().split())
    time = t - time
    dis = abs(_x - x) + abs(_y - y)
    if dis == time:
        _x = x;_yy = y;time = time
    elif dis < time and (time - dis) % 2 == 0:
        _x = x;_yy = y;time = time
    else:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
t = [0]
x = [0]
y = [0]
yes = True

n = int(input())


for i in range(n):
    inp = input()
    temp = inp.split()
    t.append(int(temp[0]))
    x.append(int(temp[1]))
    y.append(int(temp[2]))


for i in range(n):
    t_div = t[i+1] - t[i]
    dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if t_div < dist:
        yes = False
        break
    elif (t_div-dist)%2 == 1:
        yes = False
        break
    else:
        pass

if yes == True:
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))



##### main #####

def main():
	cx = 0; cy = 0
	prev_t = 0

	for i in range(I()):
		t, dist_x, dist_y = LI()

		diff = abs(dist_x - cx) + abs(dist_y - cy)		
		t -= prev_t


		if dist_x == cx and dist_y == cy:
			if (t - diff)%2 == 1:
				f = True
			else:
				f = False
				break
				
		else:
			if t >= diff and (t - diff)%2 == 0:
				f = True
			else:
				f = False
				break

		prev_t = t
		cx = dist_x
		cy = dist_y
	
	if f:
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))



##### main #####

def main():
	cx = 0; cy = 0
	prev_t = 0

	for i in range(I()):
		t, dist_x, dist_y = LI()

		diff = abs(dist_x - cx) + abs(dist_y - cy)		
		t -= prev_t


		if t >= diff and (t - diff)%2 == 0:
			f = True
		else:
			f = False
			break

		prev_t = t
		cx = dist_x
		cy = dist_y
	
	if f:
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))



##### main #####

def main():
	cx = 0; cy = 0
	prev_t = 0

	for i in range(I()):
		t, dist_x, dist_y = LI()

		diff = abs(dist_x - cx) + abs(dist_y - cy)		
		t -= prev_t


		if t > diff and (t - diff)%2 == 0:
			f = True
		else:
			f = False
			break

		prev_t = t
		cx = dist_x
		cy = dist_y
	
	if f:
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))



##### main #####

def main():
	cx = 0; cy = 0
	prev_t = 0

	for i in range(I()):
		t, dist_x, dist_y = LI()

		diff = abs(dist_x - cx) + abs(dist_y - cy)		
		t -= prev_t


		if (t - diff)%2 == 0:
			f = True
		else:
			f = False
			break

		prev_t = t
		cx = dist_x
		cy = dist_y
	
	if f:
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))



##### main #####

def main():
	cx = 0; cy = 0

	for i in range(I()):
		t, dist_x, dist_y = LI()
		# print(cx ,dist_x, cy, dist_y)
		diff = abs(dist_x - cx) + abs(dist_y - cy)
		cx = dist_x
		cy = dist_y

		if t - diff == 0 or (t - diff)%2 != 0:
			f = True
		else:
			f = False
			break

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

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
N = input()
ipts = [map(int,raw_input().split(" ")) for i in range(N)]

def solve():
    x,y = 0,0
    st = 0
    for i in range(N):
        t,nx,ny = ipts[i]
        mv = abs(nx-x) + abs(ny-y)
        mt = t - st
        
        if mv > mt:
            print "No"
            return
        if (mv - mt)%2:
            print "No"
            return
        x,y = nx,ny
        st += t

    print "Yes"
            
        

solve()

Submission status: Wrong Answer

Solution code:
N = input()
ipts = [map(int,raw_input().split(" ")) for i in range(N)]

def solve():
    x,y = 0,0
    st = 0
    for i in range(N):
        t,nx,ny = ipts[i]
        mv = abs(nx-x) + abs(ny-y)
        mt = st - t
        
        if mv < mt:
            print "No"
            return
        if (mv - mt)%2:
            print "No"
            return
        x,y = nx,ny
        st += t

    print "Yes"
            
        

solve()

Submission status: Wrong Answer

Solution code:
def test(n,t,x,y):
	for i in range(n-1):
		t1=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
		t2=t[i+1]-t[i]
		if (t1>t2 or (t2-t1)%2): return 0
	return 1
def main():
	n=int(input())
	t=[0]*n
	x=[0]*n
	y=[0]*n
	for i in range(n):
		t[i],x[i],y[i]=map(int,input().split())
	if (test(n,t,x,y)): print("Yes")
	else: print("No")
main()

Submission status: Wrong Answer

Solution code:
N = int(input())
nx, ny = 0, 0
for i in range(N):
  t, x, y = list(map(int, input().split(" ")))
  d =  abs(nx - x) + abs(ny - y)
  if d > t and d % 2:
  	print("No")
  	exit()
  else:
  	nx, ny = x, y
print("Yes")

Submission status: Wrong Answer

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


def f(poss):
    lastPos = (0, 0, 0)

    for pos in poss:
        t = pos[0] - lastPos[0]
        d = abs(pos[1] - lastPos[1]) + abs(pos[2] - lastPos[2])
        lastPos = pos

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

    return True



def main():
    n = int(input())
    poss = [tuple(map(int, input().split())) for i in range(n)]

    print('YES' if f(poss) else 'NO')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def f(poss):
    lastPos = (0, 0, 0)

    for pos in poss:
        t = pos[0] - lastPos[0]
        d = abs(pos[1] - lastPos[1]) + abs(pos[2] - lastPos[2])

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

    return True



def main():
    n = int(input())
    poss = [tuple(map(int, input().split())) for i in range(n)]

    print('YES' if f(poss) else 'NO')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

n = int(raw_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] = map(int, raw_input().split())

px = 0
py = 0
flag = True

for i in range(n):
	if i == 0:
		dt = t[i]
	else:
		dt = t[i] - t[i-1]
	dx = abs(x[i] - px)
	dy = abs(y[i] - py)

	if dt < dx + dy:
		flag = False
		break
	else:
		if (dt - (dx + dy)) % 2 == 1:
			flag = False
			break
if flag:
	print "Yes"
else:
	print "No"

Submission status: Wrong Answer

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

n = int(raw_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] = map(int, raw_input().split())

px = 0
py = 0
flag = True

for i in range(n):
	if i == 0:
		dt = t[i]
	else:
		dt = t[i] - t[i-1]
	dx = abs(x[i] - px)
	dy = abs(y[i] - py)

	if dt < dx + dy:
		flag = False
		break
	else:
		if (t[i] - (x[i] + y[i])) % 2 == 1:
			flag = False
			break
if flag:
	print "Yes"
else:
	print "No"