結果

問題 No.1506 Unbalanced Pocky Game
ユーザー Rheo TommyRheo Tommy
提出日時 2021-05-14 22:29:31
言語 Rust
(1.77.0)
結果
RE  
実行時間 -
コード長 3,899 bytes
コンパイル時間 922 ms
コンパイル使用メモリ 177,504 KB
実行使用メモリ 15,640 KB
最終ジャッジ日時 2024-04-10 01:00:30
合計ジャッジ時間 3,549 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,816 KB
testcase_01 RE -
testcase_02 AC 1 ms
6,940 KB
testcase_03 RE -
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 WA -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 5 ms
6,940 KB
testcase_16 AC 15 ms
11,112 KB
testcase_17 AC 8 ms
6,940 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 6 ms
6,944 KB
testcase_22 AC 11 ms
7,936 KB
testcase_23 RE -
testcase_24 WA -
testcase_25 AC 19 ms
14,736 KB
testcase_26 AC 25 ms
15,108 KB
testcase_27 RE -
testcase_28 AC 25 ms
14,892 KB
testcase_29 AC 25 ms
15,156 KB
testcase_30 RE -
testcase_31 AC 25 ms
15,448 KB
testcase_32 AC 24 ms
15,256 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 AC 1 ms
6,940 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 AC 1 ms
6,940 KB
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 1 ms
6,940 KB
testcase_45 AC 1 ms
6,940 KB
testcase_46 AC 10 ms
6,940 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 AC 12 ms
7,424 KB
testcase_50 AC 10 ms
6,940 KB
testcase_51 AC 11 ms
7,168 KB
testcase_52 AC 9 ms
6,944 KB
testcase_53 RE -
testcase_54 RE -
testcase_55 AC 4 ms
6,944 KB
testcase_56 RE -
testcase_57 RE -
testcase_58 AC 4 ms
6,944 KB
testcase_59 AC 3 ms
6,940 KB
testcase_60 RE -
testcase_61 AC 9 ms
6,944 KB
testcase_62 RE -
testcase_63 AC 6 ms
6,940 KB
testcase_64 AC 11 ms
7,168 KB
testcase_65 AC 6 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

// # ファイル構成
// - use 宣言
// - lib モジュール
// - main 関数
// - basic モジュール
//
// 常に使うテンプレートライブラリは basic モジュール内にあります。
// 問題に応じて使うライブラリ lib モジュール内にコピペしています。
// ライブラリのコードはこちら → https://github.com/RheoTommy/at_coder
// Twitter はこちら → https://twitter.com/RheoTommy

use std::collections::*;
use std::io::{stdout, BufWriter, Write};

use crate::basic::*;
use crate::lib::*;

pub mod lib {}

fn main() {
    let mut io = IO::new();
    let n = io.next_usize();
    let a = io.next_vec::<usize>(n).into_iter().map(|ai| ai.min(10)).collect::<Vec<_>>();

    let mut dp = vec![vec![false; 10]; n + 1];
    dp[0][0] = true;
    dp[0][1] = true;
    dp[0][2] = true;
    for i in 1..=n {
        for j in 0..a[i - 1] {
            if dp[i][j] { continue; }
            for k in j + 1..a[i - 1] {
                dp[i][k] = true;
            }
            if j == a[i - 1] - 1 {
                for k in 0..a[i] {
                    dp[i + 1][k] = true;
                }
            }
        }
    }

    io.println(if dp[n][a[n - 1] - 1] { "Alice" } else { "Bob" });
}

pub mod basic {
    pub const U_INF: u64 = (1 << 60) + (1 << 30);
    pub const I_INF: i64 = (1 << 60) + (1 << 30);

    pub struct IO {
        iter: std::str::SplitAsciiWhitespace<'static>,
        buf: std::io::BufWriter<std::io::StdoutLock<'static>>,
    }

    impl Default for IO {
        fn default() -> Self {
            Self::new()
        }
    }

    impl IO {
        pub fn new() -> Self {
            use std::io::*;
            let mut input = String::new();
            std::io::stdin().read_to_string(&mut input).unwrap();
            let input = Box::leak(input.into_boxed_str());
            let out = Box::new(stdout());
            IO {
                iter: input.split_ascii_whitespace(),
                buf: BufWriter::new(Box::leak(out).lock()),
            }
        }
        pub fn next_str(&mut self) -> &str {
            self.iter.next().unwrap()
        }
        pub fn read<T: std::str::FromStr>(&mut self) -> T
            where
                <T as std::str::FromStr>::Err: std::fmt::Debug,
        {
            self.iter.next().unwrap().parse().unwrap()
        }
        pub fn next_usize(&mut self) -> usize {
            self.read()
        }
        pub fn next_uint(&mut self) -> u64 {
            self.read()
        }
        pub fn next_int(&mut self) -> i64 {
            self.read()
        }
        pub fn next_float(&mut self) -> f64 {
            self.read()
        }
        pub fn next_chars(&mut self) -> std::str::Chars {
            self.next_str().chars()
        }
        pub fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T>
            where
                <T as std::str::FromStr>::Err: std::fmt::Debug,
        {
            (0..n).map(|_| self.read()).collect::<Vec<_>>()
        }
        pub fn print<T: std::fmt::Display>(&mut self, t: T) {
            use std::io::Write;
            write!(self.buf, "{}", t).unwrap();
        }
        pub fn println<T: std::fmt::Display>(&mut self, t: T) {
            self.print(t);
            self.print("\n");
        }
        pub fn print_iter<T: std::fmt::Display, I: Iterator<Item=T>>(
            &mut self,
            mut iter: I,
            sep: &str,
        ) {
            if let Some(v) = iter.next() {
                self.print(v);
                for vi in iter {
                    self.print(sep);
                    self.print(vi);
                }
            }
            self.print("\n");
        }
        pub fn flush(&mut self) {
            use std::io::Write;
            self.buf.flush().unwrap();
        }
    }
}
0