Submission #2544731


Source Code Expand

fn b() {
    let scan = std::io::stdin();
    let mut line = String::new();
    let _ = scan.read_line(&mut line);
    let vec: Vec<&str> = line.split_whitespace().collect();
    let joined_number = vec.join("").parse::<f32>().unwrap();
    let sqrted = joined_number.sqrt() as i32;
    if sqrted * sqrted == (joined_number as i32) {
        println!("Yes");
    } else {
        println!("No");
    }
}

struct Place {
    t: i32,
    x: i32,
    y: i32
}

fn c_can_move(place:&Place, goal:&Place) -> bool {
    let dx = place.x - goal.x; 
    let dy = place.y - goal.y; 
    let dt = place.t - goal.t; 
    println!("{:?}{:?}{:?}", dt, dx, dy);
    if dt.abs() > (dx.abs() + dy.abs()) {
        true
    } else {
        false
    }
}

fn c() {
    let mut can_traveling = true;
    let mut line = String::new();
    let _ = std::io::stdin().read_line(&mut line);
    let n = line.trim().parse::<i32>().unwrap();
    let mut place = Place{ t: 0, x: 0, y: 0 };
    for _ in 0..n {
        let _ = std::io::stdin().read_line(&mut line);
        let vec: Vec<&str> = line.split_whitespace().collect();
        let goal = Place {
            t: vec[0].parse::<i32>().unwrap(),
            x: vec[1].parse::<i32>().unwrap(),
            y: vec[2].parse::<i32>().unwrap()
        };
        if c_can_move(&place, &goal) {
            place = goal;
        } else {
            can_traveling = false;
            break;
        }
    }
    if can_traveling {
        print!("Yes");
    } else {
        print!("No");
    }
}

fn main() {
    c();
}

Submission Info

Submission Time
Task C - Traveling
User wonderfulboyx
Language Rust (1.15.1)
Score 0
Code Size 1607 Byte
Status WA
Exec Time 2 ms
Memory 4352 KB

Compile Error

warning: function is never used: `b`, #[warn(dead_code)] on by default
  --> ./Main.rs:1:1
   |
1  | fn b() {
   | ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
WA × 3
WA × 13
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 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 WA 2 ms 4352 KB
0_001.txt WA 2 ms 4352 KB
0_002.txt WA 2 ms 4352 KB
1_003.txt WA 2 ms 4352 KB
1_004.txt WA 2 ms 4352 KB
1_005.txt WA 2 ms 4352 KB
1_006.txt WA 2 ms 4352 KB
1_007.txt WA 2 ms 4352 KB
1_008.txt WA 2 ms 4352 KB
1_009.txt WA 2 ms 4352 KB
1_010.txt WA 2 ms 4352 KB
1_011.txt WA 2 ms 4352 KB
1_012.txt WA 2 ms 4352 KB