Submission #6561034


Source Code Expand

Copy
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        a: usize,
        b: usize
    }
    if (a + b) % 2 == 1 {
        println!("IMPOSSIBLE");
    } else {
        println!("{}", (a + b) / 2);
    }
}

Submission Info

Submission Time
Task A - Harmony
User cyan
Language Rust (1.15.1)
Score 100
Code Size 2026 Byte
Status AC
Exec Time 2 ms
Memory 4352 KB

Judge Result

Set Name All Sample
Score / Max Score 100 / 100 0 / 0
Status
AC × 11
AC × 3
Set Name Test Cases
All sample_01, sample_02, sample_03, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
sample_01 AC 2 ms 4352 KB
sample_02 AC 2 ms 4352 KB
sample_03 AC 2 ms 4352 KB
testcase_01 AC 2 ms 4352 KB
testcase_02 AC 2 ms 4352 KB
testcase_03 AC 2 ms 4352 KB
testcase_04 AC 2 ms 4352 KB
testcase_05 AC 2 ms 4352 KB
testcase_06 AC 2 ms 4352 KB
testcase_07 AC 2 ms 4352 KB
testcase_08 AC 2 ms 4352 KB