Submission #13945679


Source Code Expand

Copy
n = gets.chomp.to_i
t = [0]
x = [0]
y = [0]

0.upto(n-1) { |i| t[i+1], x[i+1], y[i+1] = gets.chomp.split(" ").map(&:to_i) }

can = true

0.upto(n-1) do |i|
  dt = t[i+1] - t[i]
  dist = (x[i+1] - x[i]).abs + (y[i+1] - y[i]).abs
  can = false if dt < dist
  can = false if dist % 2 != dt % 2 
end

puts can ? 'Yes' : 'No'
  

Submission Info

Submission Time
Task ABC086C - Traveling
User ayacai115
Language Ruby (2.7.1)
Score 300
Code Size 340 Byte
Status
Exec Time 178 ms
Memory 17128 KB

Judge Result

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, after_contest_01.txt
Case Name Status Exec Time Memory
0_000.txt 51 ms 14184 KB
0_001.txt 56 ms 14072 KB
0_002.txt 56 ms 14048 KB
1_003.txt 55 ms 14144 KB
1_004.txt 172 ms 17056 KB
1_005.txt 178 ms 16876 KB
1_006.txt 173 ms 17128 KB
1_007.txt 73 ms 14768 KB
1_008.txt 51 ms 14252 KB
1_009.txt 81 ms 14772 KB
1_010.txt 54 ms 14056 KB
1_011.txt 69 ms 14560 KB
1_012.txt 51 ms 14104 KB
after_contest_01.txt 54 ms 14176 KB