結果

問題 No.1363 [Zelkova Last Tune] 誰がその最後のベルを鳴らすのか?
ユーザー akakimidoriakakimidori
提出日時 2021-01-22 23:11:15
言語 Rust
(1.77.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,733 bytes
コンパイル時間 6,053 ms
コンパイル使用メモリ 156,100 KB
実行使用メモリ 18,168 KB
最終ジャッジ日時 2023-08-28 12:07:02
合計ジャッジ時間 4,501 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,356 KB
testcase_01 AC 41 ms
10,024 KB
testcase_02 AC 77 ms
18,168 KB
testcase_03 AC 1 ms
4,356 KB
testcase_04 AC 1 ms
4,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// ---------- begin scannner ----------
#[allow(dead_code)]
mod scanner {
    use std::str::FromStr;
    pub struct Scanner<'a> {
        it: std::str::SplitWhitespace<'a>
    }
    impl<'a> Scanner<'a> {
        pub fn new(s: &'a String) -> Scanner<'a> {
            Scanner {
                it: s.split_whitespace()
            }
        }
        pub fn next<T: FromStr>(&mut self) -> T {
            self.it.next().unwrap().parse::<T>().ok().unwrap()
        }
        pub fn next_chars(&mut self) -> Vec<char> {
            self.next::<String>().chars().collect()
        }
        pub fn next_vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
            (0..len).map(|_| self.next()).collect()
        }
    }
}
// ---------- end scannner ----------

use std::io::Write;

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut sc = scanner::Scanner::new(&s);
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    run(&mut sc, &mut out);
}

fn run(sc: &mut scanner::Scanner, out: &mut std::io::BufWriter<std::io::StdoutLock>) {
    let t: usize = sc.next();
    for _ in 0..t {
        let n: usize = sc.next();
        let x: u64 = sc.next();
        let y: u64 = sc.next();
        let a: Vec<u64> = sc.next_vec(n);
        let p: Vec<u64> = sc.next_vec(n);
        let mut xor = 0;
        for (a, p) in a.iter().zip(p.iter()) {
            xor ^= a % (p + 1);
        }
        let win = if xor == 0 {
            x > y
        } else {
            x + xor > y
        };
        let ans = if win {
            "Z"
        } else {
            "C"
        };
        writeln!(out, "{}", ans).ok();
    }
}
0