結果

問題 No.1107 三善アクセント
ユーザー tayu0110tayu0110
提出日時 2022-10-25 01:21:03
言語 Rust
(1.72.1)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 4,526 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 154,424 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 02:28:32
合計ジャッジ時間 2,473 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,384 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    scan!(a: [usize; 4]);
    if a[0] < a[1] && a[2] > a[3] {
        println!("YES");
    } else {
        println!("NO");
    }
}

mod iolib {
    use std::cell::RefCell;
    use std::io::{
        Read, BufRead,
        Error
    };
    use std::str::SplitWhitespace;
    use std::thread_local;

    thread_local! {
        static BUF_SPLIT_WHITESPACE: RefCell<SplitWhitespace<'static>> = RefCell::new("".split_whitespace());
    }

    #[inline]
    fn refill_buffer(interactive: bool) -> Result<(), Error> {
        let mut s = String::new();
        
        if cfg!(debug_assertions) || interactive {
            std::io::stdin().lock().read_line(&mut s)?;
        } else {
            std::io::stdin().lock().read_to_string(&mut s)?;
        }

        BUF_SPLIT_WHITESPACE.with(|buf_str| {
            *buf_str.borrow_mut() = Box::leak(s.into_boxed_str()).split_whitespace();
            Ok(())
        })
    }

    #[inline]
    pub fn scan_string(interactive: bool) -> &'static str {
        BUF_SPLIT_WHITESPACE.with(|buf_str| {
            if let Some(s) = buf_str.borrow_mut().next() {
                return s;
            }

            refill_buffer(interactive).unwrap();

            if let Some(s) = buf_str.borrow_mut().next() {
                return s;
            }

            unreachable!("Read Error: No input items.");
        })
    }

    #[macro_export]
    macro_rules! scan {
        // Terminator
        ( @interactive : $interactive:literal ) => {};
        // Terminator
        ( @interactive : $interactive:literal, ) => {};
        // Vec<Vec<....>>
        ( @interactive : $interactive:literal, $v: ident : [ [ $( $inner:tt )+ ] ; $len:expr ]) => {
            let $v = {
                let len = $len;
                (0..len).fold(vec![], |mut v, _| {
                    $crate::scan!(@interactive: $interactive, w: [ $( $inner )+ ]);
                    v.push(w);
                    v
                })
            };
        };
        // Vec<Vec<....>>, ......
        ( @interactive : $interactive:literal, $v: ident : [ [ $( $inner:tt )+ ] ; $len:expr ] , $( $rest:tt )* ) => {
            $crate::scan!(@interactive: $interactive, [ [ $( $inner )+ ] ; $len ]);
            $crate::scan!(@interactive: $interactive, $( $rest )*);
        };
        // Vec<$t>
        ( @interactive : $interactive:literal, $v:ident : [ $t:tt ; $len:expr ]) => {
            let $v = {
                let len = $len;
                (0..len).map(|_| { $crate::scan!(@interactive: $interactive, $v : $t); $v }).collect::<Vec<_>>()
            };
        };
        // Vec<$t>, .....
        ( @interactive : $interactive:literal, $v:ident : [ $t:tt ; $len:expr ] , $( $rest:tt )* ) => {
            let $v = {
                let len = $len;
                (0..len).map(|_| { $crate::scan!(@interactive: $interactive, $v : $t); $v }).collect::<Vec<_>>()
            };
            $crate::scan!(@interactive: $interactive, $( $rest )*);
        };
        // Expand tuple
        ( @interactive : $interactive:literal, @expandtuple, ( $t:tt )) => {
            { let tmp = $crate::iolib::scan_string($interactive).parse::<$t>().unwrap(); tmp }
        };
        // Expand tuple
        ( @interactive : $interactive:literal, @expandtuple, ( $t:tt $( , $rest:tt )* ) ) => {
            (
                $crate::scan!(@interactive: $interactive, @expandtuple, ( $t )),
                $( $crate::scan!(@interactive: $interactive, @expandtuple, ( $rest )), )*
            )
        };
        // let $v: ($t, $u, ....) = (.......)
        ( @interactive : $interactive:literal, $v:ident : ( $( $rest:tt )* ) ) => {
            let $v = $crate::scan!(@interactive: $interactive, @expandtuple, ( $( $rest )* ));
        };
        // let $v: $t = ......
        ( @interactive : $interactive:literal, $v:ident : $t:ty ) => {
            let $v = $crate::iolib::scan_string($interactive).parse::<$t>().unwrap();
        };
        // let $v: $t = ......, .......
        ( @interactive : $interactive:literal, $v:ident : $t:ty, $( $rest:tt )+ ) => {
            $crate::scan!(@interactive: $interactive, $v : $t);
            $crate::scan!(@interactive: $interactive, $( $rest )+);
        };
        // ......
        ( $( $rest:tt )* ) => {
            $crate::scan!(@interactive: false, $( $rest )*);
        };
    }

    #[macro_export]
    macro_rules! scani {
        ( $( $rest:tt )* ) => {
            $crate::scan!(@interactive: true, $( $rest )*);
        };
    }
}
0