Editorial for CCC '17 J3 - Exactly Electrical

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

Authors: Kirito

For this problem, we make the observation that if the car can reach any intersection (x, y) using n electric charges, it can do so in n + 2 charges. This means that if the number of charges left over after reaching (c, d) is a non-negative even number, then we should output Y, otherwise output N.

Time Complexity: \mathcal O (1)

Solution — D

import std.math;
import std.stdio;

int a, b, c, d, dis, t;

void main() {
    scanf("%d%d%d%d%d", &a, &b, &c, &d, &t);
    dis = abs(a - c) + abs(b - d);
    if(dis <= t && !((t - dis) % 2))


  • 0
    shuhanzhang  commented on May 12, 2018, 5:53 p.m.

    IDK what that means. whats %d and &a and dis...