Submission #3090706


Source Code Expand

Copy
'use strict'
let lines = [];
let reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', function(line) {
  lines.push(line);
});

reader.on('close', function() {
    let N = parseInt(lines.shift());
    let ct = 0, cx = 0, cy = 0;
    for(let i = 0; i < N; i++){
        let params = lines[i].split(/\s/).map((p) => { return parseInt(p); });
        let t = params[0], x = params[1], y = params[2];
        let dt = t - ct;
        let dist = Math.abs(x - cx) + Math.abs(y - cy);
        if(dist > dt || (dt - dist) % 2 === 1){
            console.log("No");
            return;
        }
        ct = t; cx = x; cy = y;
    }
    console.log("Yes");
});

Submission Info

Submission Time
Task ABC086C - Traveling
User my316g
Language JavaScript (node.js v5.12)
Score 300
Code Size 742 Byte
Status
Exec Time 206 ms
Memory 31952 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 59 ms 7500 KB
0_001.txt 59 ms 7500 KB
0_002.txt 59 ms 7500 KB
1_003.txt 59 ms 7500 KB
1_004.txt 206 ms 31952 KB
1_005.txt 100 ms 26648 KB
1_006.txt 198 ms 29452 KB
1_007.txt 89 ms 15608 KB
1_008.txt 61 ms 7756 KB
1_009.txt 75 ms 11232 KB
1_010.txt 60 ms 7756 KB
1_011.txt 68 ms 9868 KB
1_012.txt 60 ms 7756 KB