結果

問題 No.1082 XORのXOR
ユーザー fukafukatani
提出日時 2021-01-14 23:01:45
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 583 bytes
コンパイル時間 19,121 ms
コンパイル使用メモリ 404,080 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-24 17:57:03
合計ジャッジ時間 16,236 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_imports)]
use std::cmp::*;

fn main() {
    let n = read::<usize>();
    let a = read_vec::<i64>();
    let mut ans = 0;
    for i in 0..n {
        for j in i + 1..n {
            ans = max(ans, a[i] ^ a[j]);
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
0