Submit Info #56151

Problem Lang User Status Time Memory
Many A + B rust Haar AC 1469 ms 19.85 MiB

ケース詳細
Name Status Time Memory
all_max_00 AC 1469 ms 19.85 MiB
all_zero_00 AC 904 ms 2.47 MiB
digit_random_00 AC 1156 ms 11.34 MiB
digit_random_01 AC 1225 ms 11.35 MiB
example_00 AC 0 ms 0.61 MiB
max_random_00 AC 1441 ms 19.33 MiB
max_random_01 AC 1434 ms 19.34 MiB
random_00 AC 556 ms 7.96 MiB
random_01 AC 661 ms 9.34 MiB

use std::io::Read; #[allow(unused_macros)] macro_rules! get { ( [$a:tt; $num:expr] ) => { { let n = $num; (0 .. n).map(|_| get!($a)).collect::<Vec<_>>() } }; ( ($($type:ty),*) ) => { ($(get!($type)),*) }; ( $type:ty ) => { { let cin = std::io::stdin(); let mut cin = cin.lock(); let token = cin.by_ref().bytes().map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::<String>(); token.parse::<$type>().expect( format!("cannot convert \"{}\" into {}", token, stringify!($type)).as_str() ) } }; } #[allow(unused_macros)] macro_rules! input { ( @inner mut $name:ident : $type:tt ) => { let mut $name = get!($type); }; ( @inner $name:ident : $type:tt ) => { let $name = get!($type); }; ( $($($names:ident)* : $type:tt),* ) => { $( input!(@inner $($names)* : $type); )* } } pub trait JoinStr { fn join_str(&self, _: &str) -> String; } impl<T: std::fmt::Display> JoinStr for Vec<T> { fn join_str(&self, s: &str) -> String { (&self.iter().map(|x| format!("{}", x)).collect::<Vec<_>>()).join(s).to_string() } } macro_rules! impl_join_str_tuple { ( $head:ident ) => { impl<$head: std::fmt::Display> JoinStr for ($head,) { #[allow(non_snake_case, redundant_semicolons)] fn join_str(&self, _: &str) -> String { let (ref $head,) = *self; format!("{}", $head) } } }; ( $head:ident, $($tail:ident),+ ) => { impl<$head: std::fmt::Display, $($tail: std::fmt::Display),+> JoinStr for ($head, $($tail),*) { #[allow(non_snake_case, redundant_semicolons)] fn join_str(&self, s: &str) -> String { let mut ret = vec![]; let (ref $head, $(ref $tail,)+) = *self; ret.push(format!("{}", $head)); $( ret.push(format!("{}", $tail)); )+; ret.join_str(s) } } impl_join_str_tuple!($($tail),+); } } impl_join_str_tuple!(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11); fn main() { input!(n: usize); for _ in 0 .. n { input!(a: u64, b: u64); println!("{}", a + b); } }