Problem:


Score : 300 points

Problem Statement

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

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

Constraints

1 ≤ N ≤ 10^5

0 ≤ x_i ≤ 10^5

0 ≤ y_i ≤ 10^5

1 ≤ t_i ≤ 10^5

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

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N

Output

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

Sample Input 1

2
3 1 2
6 1 1

Sample Output 1

Yes

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

Sample Input 2

1
2 100 100

Sample Output 2

No

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

Sample Input 3

2
5 1 1
100 1 1

Sample Output 3

No



Sample input:
2
3 1 2
6 1 1


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
import sys

def main():
    N = int(input())
    t = [0] * (N+1)
    x = [0] * (N+1)
    y = [0] * (N+1)
    for i in range(1, N+1):
        t[i], x[i], y[i] = map(int, input().split())
    
    flag = True
    for i in range(N):
        dt = t[i+1] - t[i]
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
        if dt % 2 != dist % 2:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

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())
    
    flag = True
    for i in range(N-1):
        dt = t[i+1] - t[i]
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
        if dt % 2 != dist % 2:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
L = [list(map(int,input().split())) for i in range(n)]
#print(L)
if n == 1:
    dis = abs(L[0][1]) + abs(L[0][2])
    if dis == 0:
        print("Yes")
        exit()
    if L[0][0] >= dis and L[0][0]%dis == 0:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
        
for i in range(n-1):
    t = L[i+1][0] - L[i][1]
    dis = abs(L[i+1][1] - L[i][1]) + abs(L[i+1][2] - L[i][2])
    if dis == 0:
        if t%2 == 0:
            flag = True
        else:
            flag = False
            break
    else:
        if t >= dis and t%dis == 0:
            flag = True
        else:       
            flag = False
            break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

n = int(input())

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

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

print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#初期値に関する処理がないのでNG
import sys

N = int(input())
arr = [list(map(int,input().split())) for i in range(N)]

#初期値対応
if arr[0][0] < arr[0][1] + arr[0][1]:
    print("No")
    exit()

for i in range(len(arr)-1):
    if arr[i+1][0]-arr[i][0] < abs(arr[i+1][1]-arr[i][1])+abs(arr[i+1][2]-arr[i][2]) or (arr[i+1][0]-arr[i][0])%2 != (abs(arr[i+1][1]-arr[i][1])+abs(arr[i+1][2]-arr[i][2]))%2:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
arr = [list(map(int,input().split())) for i in range(N)]

for i in range(len(arr)-1):
    if arr[i+1][0]-arr[i][0] < abs(arr[i+1][1]-arr[i][1])+abs(arr[i+1][2]-arr[i][2]) or (arr[i+1][0]-arr[i][0])%2 != (abs(arr[i+1][1]-arr[i][1])+abs(arr[i+1][2]-arr[i][2]))%2:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())
    t_i, x_i, y_i = map(int, input().split())
    for i in range(N-1):
        t_j, x_j, y_j = map(int, input().split())
        dt = t_j - t_i
        dxy = x_i + x_j - y_i - y_j
        if (dt > (t_j - t_i)) | (dt < (t_i - t_j)):
            return "No"
        if ((t_i - t_j) % 2) != (dxy % 2):
            return "No"
    return "Yes"


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

Submission status: Wrong Answer

Solution code:
n = int(input())
list_A = [ list(map(int,input().split(" "))) for i in range(n)]
list_A.insert(0, [0, 0, 0])
ans = "Yes"
for i in range(1, n+1):
    l = list_A[i]
    k = list_A[i-1]
    distance = abs(l[1]-k[1]) + abs(l[2]-k[2])
    if distance > l[0] - k[0]:
        ans = "No"
        break
    else:
        if distance - (l[0]-k[0]) % 2 == 1:
            ans = "No"
    if l[1] == k[1] and l[2] == k[2]:
        if distance == 2:
            ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
list_A = [ list(map(int,input().split(" "))) for i in range(n)]
list_A.insert(0, [0, 0, 0])
ans = "Yes"
for i in range(1, n+1):
    l = list_A[i]
    k = list_A[i-1]
    distance = abs(l[1]-k[1]) + abs(l[2]-k[2])
    if distance > l[0] - k[0]:
        ans = "No"
        break
    else:
        if distance - (l[0]-k[0]) % 2 == 1:
            ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int,input().split())) for _ in range(n)]
for i in range(n-1):
  t = txy[i+1][0] - txy[i][0]
  x = abs(txy[i+1][1] - txy[i][1])
  y = abs(txy[i+1][2] - txy[i][2])
  if t < x+y:
    print('No')
    exit()
  elif t == x+y:
    pass
  else:
    if ((t%2 == 0) and ((x+y)%2 == 0)) or ((t%2 != 0)and((x+y)%2 != 0)):
      pass
    else:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

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

t, x, y = 0, 0, 0

flag = True
for ti, xi, yi in d:
  if ti >= x + y:
    if (ti - t) % 2 != (abs(xi - x) + abs(yi - y)) % 2:
    	flag = False
    	break
    t = ti
    x = xi
    y = yi
    
  else:
    flag = False
    break
    
print("Yes" if flag else "No")

Submission status: Wrong Answer

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

t, x, y = 0, 0, 0

flag = True
for ti, xi, yi in d:
  if ti > x + y:
    if (ti - t) % 2 != (abs(xi - x) + abs(yi - y)) % 2:
    	flag = False
    	break
    t = ti
    x = xi
    y = yi
    
  else:
    flag = False
    break
    
print("Yes" if flag else "No")

Submission status: Wrong Answer

Solution code:
N=int(input())
tl=[]
xl=[]
yl=[]
al=[]
bl=[]
cl=[]
dl=[]

for i in range(N):
 t,x,y=map(int,input().split())
 tl.append(t)
 xl.append(x)
 yl.append(y)
 al.append((x+y)%2)
 bl.append(t%2)
 print(x)
for i in range(N):
 c=abs((xl[i]+yl[i])-(xl[i-1]+yl[i-1]))
 d=tl[i]-tl[i-1]
 cl.append(c)
 dl.append(d)

if al==bl and (xl+yl)<=tl and cl<=dl:
 print("Yes")
else :
  print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N):
 t,x,y=list(map(int,input().split()))
 a=[(x+y)%2]
 b=[t%2]

if a==b and (x+y)<=t:
  print("Yes")
else :
  print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N):
 t,x,y=list(map(int,input().split()))
 a=[(x+y)%2]
 b=[t%2]

if a==b:
  print("Yes")
else :
  print("No")

Submission status: Wrong Answer

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

for i,t in enumerate(txy):
    if i>=1:
        base=abs(t[1]-txy[i-1][0])+abs(t[2]-txy[i-1][2])
        time=t[0]-txy[i-1][0]
        if base<=time and (time-base)%2==0:
            pass
        else:
            answer="No"
            break
print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
TXY = [tuple(map(int,input().split())) for i in range(N)]
ct = cx = cy = 0
for t,x,y in TXY:
    d = abs(cx-x) + abs(cy-y)
    if d > t-ct or d%2 != (t-ct)%2:
        print('No')
        exit()
    ct,cx,xy = t,x,y
print('Yes')

Submission status: Wrong Answer

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

t = 0
x = 0
y = 0
for t1, x1, y1 in info:
    diff = abs(x - x1) + abs(y - y1)
    diff_t = abs(t - t1)
    if diff_t >= diff and diff % 2 == diff % 2:
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import fileinput

def main():
	pos = [0, 0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = abs(x - pos[1]) + abs(y - pos[2])
		dt = t - pos[0]
        
        
		if dest <= dt and dest % 2 == t % 2:
			pos[0] = t
			pos[1] = x
			pos[2] = y
			next
		else:
			return print("No")
	print("Yes")
                
main()

Submission status: Wrong Answer

Solution code:
import fileinput

def main():
	pos = [0, 0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = abs(x - pos[1]) + abs(y - pos[2])
		t_d = t - pos[0]
        
        
		if not dest > t_d and (dest % 2 == t % 2):
			pos[0], pos[1], pos[2] = t, x, y
			next
		else:
			return print("No")
	print("Yes")
                
main()

Submission status: Wrong Answer

Solution code:
import fileinput

def main():
	pos = [0, 0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = abs(x - pos[1]) + abs(y - pos[2])
		t_d = t - pos[0]
        
        
		if (dest <= t_d and (dest % 2 == t % 2)):
			pos[0], pos[1], pos[2] = t, x, y
			next
		else:
			return print("No")
	print("Yes")
                
main()

Submission status: Wrong Answer

Solution code:
import fileinput

def main():
	pos = [0, 0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = abs(x - pos[1]) + abs(y - pos[2])
		t_d = t - pos[0]
        
        
		if (dest <= t and (dest % 2 == t % 2)):
			pos[0], pos[1], pos[2] = t, x, y
			next
		else:
			return print("No")
	print("Yes")
                
main()

Submission status: Wrong Answer

Solution code:
import fileinput

def main():
	pos = [0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = abs(x - pos[0]) + abs(y - pos[1])
        
        
		if (dest <= t and (dest % 2 == t %2)):
			pos[0], pos[1] = x, y
			next
		else:
			return print("No")
	print("Yes")
                
main()

Submission status: Wrong Answer

Solution code:
import fileinput

def main():
	pos = [0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = x + y
		src = sum(pos)
		if (abs(dest - src) > t):
			return print("No")
		else:
			arrivable = True if not abs(dest - src - t) % 2 else False
			if (arrivable):
				pos[0], pos[1] = x, y
				next
			else:
				return print("No")
              
	print("Yes")
                
main()

Submission status: Wrong Answer

Solution code:
import fileinput

def main():
	pos = [0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = x + y
		src = sum(pos)
		if (dest - src > t):
			return print("No")
		else:
			arrivable = True if not abs(dest - src - t) % 2 else False
			if (arrivable):
				pos[0], pos[1] = x, y
				next
			else:
				return print("No")
              
	print("Yes")
                
main()

Submission status: Wrong Answer

Solution code:
import fileinput

def main():
	pos = [0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	print(lines)
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = x + y
		src = sum(pos)
		if (dest - src > t):
			return print("No")
		else:
			arrivable = True if not abs(dest - src - t) % 2 else False
			if (arrivable):
				pos[0], pos[1] = x, y
				next
			else:
				return print("No")
              
	print("Yes")
                
main()

Submission status: Wrong Answer

Solution code:
import fileinput

def main():
	pos = [0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	print(lines)
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = x + y
		src = sum(pos)
		if (dest - src > t):
			return print("No")
		else:
			if not (dest - src % t):
				pos[0], pos[1] = x, y
				next
	print("Yes")
                
main()

Submission status: Wrong Answer

Solution code:
N=int(input())
txy=[]
for i in range(N):
  t,x,y=map(int,input().split())
  txy.append([t,x,y])
  
print(txy)

count=0
for i in range(N-1):
  dt = abs(txy[i+1][0]-txy[i][0])
  ds = abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])
  if dt < ds:
    print("No")
    exit()
  else:
    if dt%2==ds%2:
      count+=1
    else:
      print("No")
      exit()

if count==N-1:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
txy=[]
for i in range(N):
  t,x,y=map(int,input().split())
  txy.append([t,x,y])
  
#print(txy)

count=0
for i in range(N-1):
  dt = abs(txy[i+1][0]-txy[i][0])
  ds = abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])
  if dt < ds:
    print("No")
    exit()
  else:
    if (dt-ds)%2==0 :
      count+=1
    else:
      print("No")
      exit()

if count==N-1:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
txy=[]
for i in range(N):
  t,x,y=map(int,input().split())
  txy.append([t,x,y])
  
#print(txy)

count=0
for i in range(N-1):
  dt = abs(txy[i+1][0]-txy[i][0])
  ds = abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])
  if dt < ds:
    print("No")
    exit()
  else:
    if (dt-ds)%2==0:
      #print("Yes")
      count+=1
    else:
      print("No")
      exit()

if count==N-1:
  print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
t = [0]
x = [0]
y = [0]
count = 0
for i in range(n):
    val_list = input().split()
    if val_list:
        t.append(int(val_list[0]))
        x.append(int(val_list[1]))
        y.append(int(val_list[2]))
for i in range(n):
    distance = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    if distance > t[i + 1] - t[i]:
        break
    elif distance == t[i + 1] - t[i]:
        count += 1
    elif distance - (t[i + 1] - t[i]) % 2 == 0:
        count += 1
    else:
        break
if count == n:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
tmp_a = 0
tmp_b_c = 0
flg = 0
for i in range(n):
  a,b,c = map(int, input().split())
  a = a - tmp_a
  if a < b + c or a % 2 != (b + c - tmp_b_c) % 2:
    flg = 1
  tmp_a = a
  tmp_b_c = b + c
if flg == 0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
tmp_a = 0
tmp_b_c = 0
flg = 0
for i in range(n):
  a,b,c = map(int, input().split())
  a = a - tmp_a
  if a < b + c or a % 2 == (b + c - tmp_b_c) % 2:
    flg = 1
  tmp_a = a
  tmp_b_c = b + c
if flg == 0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
tmp = 0
flg = 0
for i in range(n):
  a,b,c = map(int, input().split())
  a = a - tmp
  if a < b + c or tmp % 2 == (b + c) % 2:
    flg = 1
  tmp = a
if flg == 0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nexttime = 0
nextx = 0
nexty = 0


for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  if ( (nexttime < nextx+nexty) or ((((nextx + nexty) ) % 2) != (nexttime % 2) ) ):
    print("NO")
    exit()


print("YES")

Submission status: Wrong Answer

Solution code:
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nowtime = 0
nowx = 0
nowy = 0

nexttime = 0
nextx = 0
nexty = 0

costtime = 0
diffx = 0
diffy = 0

for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  costtime = nexttime - nowtime
  diffx = abs(nextx - nowx)
  diffy = abs(nexty - nowy)
  if ( (nexttime < nextx+nexty) or ((((nextx + nexty) ) % 2) == (nexttime % 2) ) ):
    print("NO")
    exit()
  nowtime = nexttime
  nowx = nextx
  nowy = nexty



print("YES")

Submission status: Wrong Answer

Solution code:
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nowtime = 0
nowx = 0
nowy = 0

nexttime = 0
nextx = 0
nexty = 0

costtime = 0
diffx = 0
diffy = 0

for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  costtime = nexttime - nowtime
  diffx = abs(nextx - nowx)
  diffy = abs(nexty - nowy)
  if ( (costtime < diffx + diffy) or ((((nextx + nexty) ) % 2) == (nexttime % 2) ) ):
    print("NO")
    exit()
  nowtime = nexttime
  nowx = nextx
  nowy = nexty



print("YES")

Submission status: Wrong Answer

Solution code:
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nowtime = 0
nowx = 0
nowy = 0

nexttime = 0
nextx = 0
nexty = 0

costtime = 0
diffx = 0
diffy = 0

for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  costtime = nexttime - nowtime
  diffx = abs(nextx - nowx)
  diffy = abs(nexty - nowy)
  if ( (costtime < diffx + diffy) or ((((diffx + diffy) ) % 2) == (costtime % 2) ) ):
    print("NO")
    exit()
  nowtime = nexttime
  nowx = nextx
  nowy = nexty



print("YES")

Submission status: Wrong Answer

Solution code:
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nowtime = 0
nowx = 0
nowy = 0

nexttime = 0
nextx = 0
nexty = 0

costtime = 0
diffx = 0
diffy = 0

for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  costtime = nexttime - nowtime
  diffx = abs(nextx - nowx)
  diffy = abs(nexty - nowy)
  if ( (costtime < diffx + diffy) or ((((diffx + diffy) - costtime ) % 2) == 1 ) ):
    print("NO")
    exit()
  nowtime = nexttime
  nowx = nextx
  nowy = nexty



print("YES")

Submission status: Wrong Answer

Solution code:
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nowtime = 0
nowx = 0
nowy = 0

nexttime = 0
nextx = 0
nexty = 0

costtime = 0
diffx = 0
diffy = 0

for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  costtime = nexttime - nowtime
  diffx = abs(nextx - nowx)
  diffy = abs(nexty - nowy)
  if ( (costtime < diffx + diffy) or (((costtime - (diffx + diffy)) % 2) == 1 ) ):
    print("NO")
    exit()
  nowtime = nexttime
  nowx = nextx
  nowy = nexty



print("YES")

Submission status: Wrong Answer

Solution code:
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nowtime = 0
nowx = 0
nowy = 0

nexttime = 0
nextx = 0
nexty = 0

costtime = 0
diffx = 0
diffy = 0

for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  costtime = nexttime - nowtime
  diffx = abs(nextx - nowx)
  diffy = abs(nexty - nowy)
  if ( (costtime < diffx + diffy) or (((costtime - (diffx + diffy)) % 2) == 1 ) ):
    print("NO")
    exit()




print("YES")

Submission status: Wrong Answer

Solution code:
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nowtime = 0
nowx = 0
nowy = 0

nexttime = 0
nextx = 0
nexty = 0

costtime = 0
diffx = 0
diffy = 0

for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  costtime = nexttime - nowtime
  diffx = nextx - nowx
  diffy = nexty - nowy
  if ( (costtime < diffx + diffy) or (((costtime - (diffx + diffy)) % 2) == 1 ) ):
    print("NO")
    exit()




print("YES")

Submission status: Wrong Answer

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

cnt = 0

for l in range(len(L)-1):
    length = (L[l+1][1] - L[l][1] + L[l+1][2] + L[l][2]) - (L[l+1][0] - L[l][0]) 
    if not (length <= 0 and length % 2 == 0):
        print("No")
        break
    else:
        cnt += 1

if cnt == len(L) - 1:
    print("Yes")

Submission status: Wrong Answer

Solution code:
def calc_move_value(d, c):
    if d > c:
        return 1
    else:
        return -1

def solution():
    n = int(input())
    cur_x, cur_y, already_moved_cnt = 0, 0, 0
    for i in range(n):
        t, dist_x, dist_y = map(int, input().split())
        move_cnt = t - already_moved_cnt
        for j in range(move_cnt):
            if cur_x != dist_x:
                cur_x += calc_move_value(dist_x, cur_x)
            elif cur_y != dist_y:
                cur_y += calc_move_value(dist_y, cur_y)
            else:
                cur_x += 1
        if not (cur_x == dist_x and cur_y == dist_y):
            print('No')
            return
        already_moved_cnt += t
    print('Yes')

solution()

Submission status: Wrong Answer

Solution code:
def calc_move_value(d, c):
    if d > c:
        return 1
    else:
        return -1

def solution():
    n = int(input())
    plans = [
        list(map(int, input().split()))
        for i in range(n)
    ]
    cur_x, cur_y, already_moved_cnt = 0, 0, 0
    for plan in plans:
        t, dist_x, dist_y = plan[0], plan[1], plan[2]
        move_cnt = t - already_moved_cnt
        for i in range(move_cnt):
            if cur_x != dist_x:
                cur_x += calc_move_value(dist_x, cur_x)
            elif cur_y != dist_y:
                cur_y += calc_move_value(dist_y, cur_y)
            else:
                cur_x += 1
        if not (cur_x == dist_x and cur_y == dist_y):
            print('No')
            return
        already_moved_cnt += t
    print('Yes')

solution()

Submission status: Wrong Answer

Solution code:
def calc_move_value(d, c):
    if d > c:
        return 1
    else:
        return -1

def solution():
    n = int(input())
    plans = [
        list(map(int, input().split()))
        for i in range(n)
    ]
    cur_x, cur_y, already_moved_cnt = 0, 0, 0
    for plan in plans:
        t, dist_x, dist_y = plan[0], plan[1], plan[2]
        move_cnt = t - already_moved_cnt
        for i in range(move_cnt):
            if cur_x != dist_x:
                cur_x += calc_move_value(dist_x, cur_x)
            elif cur_y != dist_y:
                cur_y += calc_move_value(dist_y, cur_y)
            else:
                cur_x += 1
        if (cur_x != dist_x) or (cur_y != dist_y):
            print('No')
            return
        already_moved_cnt += t
    print('Yes')

solution()

Submission status: Wrong Answer

Solution code:
def calc_move_value(d, c):
    if d > c:
        return 1
    else:
        return -1

def solution():
    n = int(input())
    plans = [
        list(map(int, input().split()))
        for i in range(n)
    ]
    cur_x, cur_y, already_moved_cnt = 0, 0, 0
    for plan in plans:
        t, dist_x, dist_y = plan[0], plan[1], plan[2]
        move_cnt = t - already_moved_cnt
        for i in range(move_cnt):
            if cur_x != dist_x:
                cur_x = calc_move_value(dist_x, cur_x)
            elif cur_y != dist_y:
                cur_x = calc_move_value(dist_y, cur_y)
            else:
                cur_x += 1
        if (cur_x != dist_x) or (cur_y != dist_y):
            print('No')
            return
        already_moved_cnt += t
    print('Yes')

solution()

Submission status: Wrong Answer

Solution code:
def get_move_value(d, c):
    if d > c:
        return 1
    else:
        return -1

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

    current_x, current_y = 0, 0
    already_loop_sum = 0
    for plan in plans:
        move_cnt = plan[0] - already_loop_sum
        dist_x, dist_y = plan[1], plan[2]
        for i in range(move_cnt):
            if current_x != dist_x:
                current_x = get_move_value(dist_x, current_x)
            elif current_y != dist_y:
                current_x = get_move_value(dist_y, current_y)
            else:
                current_x += 1
        if (current_x != dist_x) or (current_y != dist_y):
            print('No')
            return
        already_loop_sum += plan[0]
    print('Yes')

solution()

Submission status: Wrong Answer

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

    current_x, current_y = 0, 0
    already_loop_sum = 0
    for plan in plans:
        sec = plan[0] - already_loop_sum
        dist_x = plan[1]
        dist_y = plan[2]
        for i in range(sec):
            if current_x != dist_x:
                if dist_x > current_x:
                    current_x += 1
                else:
                    current_x -= 1
            elif current_y != dist_y:
                if dist_y > current_y:
                    current_y += 1
                else:
                    current_y -= 1
            else:
                current_x -= 1
        if current_x != dist_x or current_y != dist_y:
            print('No')
            return
        already_loop_sum += plan[0]
    print('Yes')

solution()

Submission status: Wrong Answer

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

    current_x, current_y = 0, 0
    already_loop_sum = 0
    for plan in plans:
        sec = plan[0] - already_loop_sum
        dist_x = plan[1]
        dist_y = plan[2]
        for i in range(sec):
            if current_x != dist_x:
                if dist_x > current_x:
                    current_x += 1
                else:
                    current_x -= 1
            elif current_y != dist_y:
                if dist_y > current_y:
                    current_y += 1
                else:
                    current_y -= 1
            else:
                current_x += 1
        if current_x != dist_x or current_y != dist_y:
            print('No')
            return
        already_loop_sum += plan[0]
    print('Yes')

solution()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    def iterate_position():
        yield list(map(int, sys.stdin.readline().rstrip().split()))

    N = int(sys.stdin.readline().rstrip())
    now_position = [0, 0, 0]
    for x in range(N):
        try:
            next_position = next(iterate_position())
            dt = next_position[0] - now_position[0]
            dx = next_position[1] - now_position[1]
            dy = next_position[2] - now_position[2]
            if dt < abs(dx) + abs(dy):
                print("No")
                sys.exit()
            check = dt - (dx + dy)
            if check % 2 == 1:
                print("No")
                sys.exit()
            now_position = next_position
        except StopIteration:
            print("No")
    else:
        print("No")

if __name__ == '__main__':
    main()

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) >(x+y+t)%2:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
t=[]
x=[]
y=[]
flag=False
for i in range(N):
  t1,x1,y1=[int(i) for i in input().split()]
  t.append(t1)
  x.append(x1)
  y.append(y1)
for i in range(N):
  if(i>0):
    t[i]=t[i]-t[i-1]
    x[i]=x[i]-x[i-1]
    y[i]=y[i]-y[i-1]

for i in range(N):
  if((x[i]+y[i])%2==t[i] and abs(x[i])+abs(y[i])<=t[i]):
    flag=True
  else:
    flag=False
    break

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

Submission status: Wrong Answer

Solution code:
N=int(input())
t=[]
x=[]
y=[]
flag=False
for i in range(N):
  t1,x1,y1=[int(i) for i in input().split()]
  t.append(t1)
  x.append(x1)
  y.append(y1)
for i in range(N):
  if(i>0):
    t[i]=t[i]-t[i-1]
    x[i]=x[i]-x[i-1]
    y[i]=y[i]-y[i-1]

for i in range(N):
  if((x[i]+y[i])%2==t[i] or abs(x[i])+abs(y[i])<=t[i]):
    flag=True
  else:
    flag=False
    break
if(flag):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

ans = "YES"
for i in range(N):
	norm = abs(P[i+1][1]-P[i][1])+abs(P[i+1][2]-P[i][2])
	move = (P[i+1][0]-P[i][0]) - norm
	if ((move%2 != 0) or (move < 0)):
		ans = "NO"
		break
	
print(ans)

Submission status: Wrong Answer

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

ans = "YES"
for i in range(N):
	norm = abs(P[i+1][1]-P[i][1])+abs(P[i+1][2]-P[i][2])
	if (P[i+1][0]-P[i][0])%2 != norm%2:
		ans = "NO"
		break
	#else:
	#	if norm %2 == 0:
	#	ans = "NO"
	#		break
	
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
pre_t=0
pre_x=0
pre_y=0
flg=0
for i in range(N-1):
    t,x,y=map(int,input().split())
    t_tmp = t
    t=t-pre_t
    dist=abs(x-pre_x) + abs(y - pre_y)
    pre_t=t_tmp
    pre_x=x
    pre_y=y
    if(dist > t ):
        flg=1
        break
    if((dist)%2 != pre_t%2):
        flg=1
        break
if(flg == 0):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
pre_t=0
pre_x=0
pre_y=0
flg=0
for i in range(N-1):
    t,x,y=map(int,input().split())
    t_tmp = t
    t=t-pre_t
    dist=abs(x-pre_x) + abs(y - pre_y)
    pre_t=t_tmp
    pre_x=x
    pre_y=y
    if(dist >= t ):
        flg=1
        break
    if((dist)%2 != t%2):
        flg=1
        break
if(flg == 0):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
pre_t=0
pre_x=0
pre_y=0
flg=0
for i in range(N-1):
    t,x,y=map(int,input().split())
    t_tmp = t
    t=t-pre_t
    dist=abs(x-pre_x) + abs(y - pre_y)
    pre_t=t_tmp
    pre_x=x
    pre_y=y
    if(dist > t ):
        flg=1
        break
    if((dist)%2 != t%2):
        flg=1
        break
if(flg == 0):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
pre_t=0
flg=0
for i in range(N-1):
    t,x,y=map(int,input().split())
    t_tmp = t
    t=t-pre_t
    pre_t=t_tmp
    if((x+y)%t != 0):
        flg=1
        break
if(flg == 0):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
TXY=[list(map(int,input().split(' '))) for i in range(N)]
t,x,y=0,0,0
for i,j,k in TXY:
    if i-t!=abs(x-j)+abs(y+k):
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
T, X, Y = 0, 0, 0
cnt = 0
for n in range(int(input())):
  t, x, y = map(int,input().split())
  dist = abs(x-X) + abs(y-Y)
  dt = t - T
  cnt += all([dist <= dt, (dist - dt) % 2 == 0])
  T, X, Y = t, x, y
print("YNeos"[n>cnt::2])