結果

問題 No.1674 Introduction to XOR
ユーザー akakimidori
提出日時 2021-08-14 02:37:03
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 648 bytes
コンパイル時間 11,237 ms
コンパイル使用メモリ 400,048 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 21:41:24
合計ジャッジ時間 12,327 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

fn read() -> Vec<usize> {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let mut next = |l: usize, r: usize| -> usize {
        let v = it.next().unwrap().parse::<usize>().unwrap();
        assert!(l <= v && v <= r);
        v
    };
    let n = next(1, 100);
    let mut a = vec![0; n];
    for a in a.iter_mut() {
        *a = next(1, 10usize.pow(18));
    }
    a
}

fn main() {
    let a = read();
    let shift = (0..).find(|k| a.iter().all(|a| *a >> k & 1 == 0)).unwrap();
    let ans = 1usize << shift;
    println!("{}", ans);
}
0