Submission #2202704


Source Code Expand

Copy
N = int(input())
flg = True
cnt,now,posx,posy=0,0,0,0
while cnt < N and flg:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = t
    posx = x
    posy = y
    cnt += 1
if flg:
  print('Yes')

Submission Info

Submission Time
Task ABC086C - Traveling
User Yellowstone
Language Python3 (3.4.3)
Score 300
Code Size 463 Byte
Status
Exec Time 397 ms
Memory 3064 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt, 0_002.txt
All 300 / 300 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt
Case Name Status Exec Time Memory
0_000.txt 17 ms 3064 KB
0_001.txt 17 ms 3064 KB
0_002.txt 17 ms 3064 KB
1_003.txt 17 ms 3064 KB
1_004.txt 396 ms 3064 KB
1_005.txt 17 ms 3064 KB
1_006.txt 397 ms 3064 KB
1_007.txt 77 ms 3064 KB
1_008.txt 18 ms 3064 KB
1_009.txt 17 ms 3064 KB
1_010.txt 17 ms 3064 KB
1_011.txt 17 ms 3064 KB
1_012.txt 17 ms 3064 KB