結果

問題 No.1363 [Zelkova Last Tune] 誰がその最後のベルを鳴らすのか?
ユーザー akakimidoriakakimidori
提出日時 2021-01-22 23:07:05
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,757 bytes
コンパイル時間 1,155 ms
コンパイル使用メモリ 148,840 KB
実行使用メモリ 18,272 KB
最終ジャッジ日時 2023-08-27 21:52:49
合計ジャッジ時間 2,232 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,376 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 {
            let q = y / xor;
            x >= q
        };
        let ans = if win {
            "Z"
        } else {
            "C"
        };
        writeln!(out, "{}", ans).ok();
    }
}
0