結果

問題 No.2672 Subset Xor Sum
ユーザー powellpowell
提出日時 2024-03-15 22:06:19
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,764 bytes
コンパイル時間 648 ms
コンパイル使用メモリ 178,348 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-15 22:06:22
合計ジャッジ時間 2,854 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 1 ms
6,676 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
6,676 KB
testcase_22 AC 1 ms
6,676 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
6,676 KB
testcase_26 AC 1 ms
6,676 KB
testcase_27 AC 1 ms
6,676 KB
testcase_28 AC 1 ms
6,676 KB
testcase_29 WA -
testcase_30 AC 15 ms
6,676 KB
testcase_31 AC 7 ms
6,676 KB
testcase_32 AC 6 ms
6,676 KB
testcase_33 AC 11 ms
6,676 KB
testcase_34 AC 15 ms
6,676 KB
testcase_35 AC 13 ms
6,676 KB
testcase_36 AC 14 ms
6,676 KB
testcase_37 AC 8 ms
6,676 KB
testcase_38 AC 16 ms
6,676 KB
testcase_39 AC 4 ms
6,676 KB
testcase_40 AC 10 ms
6,676 KB
testcase_41 AC 14 ms
6,676 KB
testcase_42 AC 12 ms
6,676 KB
testcase_43 AC 16 ms
6,676 KB
testcase_44 AC 10 ms
6,676 KB
testcase_45 AC 1 ms
6,676 KB
testcase_46 AC 1 ms
6,676 KB
testcase_47 AC 1 ms
6,676 KB
testcase_48 AC 1 ms
6,676 KB
testcase_49 AC 2 ms
6,676 KB
testcase_50 AC 1 ms
6,676 KB
testcase_51 AC 2 ms
6,676 KB
testcase_52 AC 1 ms
6,676 KB
testcase_53 AC 1 ms
6,676 KB
testcase_54 AC 1 ms
6,676 KB
testcase_55 AC 1 ms
6,676 KB
testcase_56 AC 1 ms
6,676 KB
testcase_57 AC 1 ms
6,676 KB
testcase_58 AC 2 ms
6,676 KB
testcase_59 AC 1 ms
6,676 KB
testcase_60 AC 1 ms
6,676 KB
testcase_61 AC 1 ms
6,676 KB
testcase_62 AC 1 ms
6,676 KB
testcase_63 AC 1 ms
6,676 KB
testcase_64 AC 1 ms
6,676 KB
testcase_65 WA -
testcase_66 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `N`
 --> Main.rs:4:9
  |
4 |     let N = get!(usize);
  |         ^ help: if this is intentional, prefix it with an underscore: `_N`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: variable `N` should have a snake case name
 --> Main.rs:4:9
  |
4 |     let N = get!(usize);
  |         ^ help: convert the identifier to snake case: `n`
  |
  = note: `#[warn(non_snake_case)]` on by default

warning: variable `A` should have a snake case name
 --> Main.rs:5:9
  |
5 |     let A = get!(u16;;);
  |         ^ help: convert the identifier to snake case: `a`

warning: 3 warnings emitted

ソースコード

diff #

// 5000 < 2^13

fn main() {
    let N = get!(usize);
    let A = get!(u16;;);

    // 総xor
    let res = A.iter().fold(0, |acc, x| acc ^ x);

    if res == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}

mod get_macro {
    //! 入力用マクロ
    //! - 参考:[Rustで競技プログラミング スターターキット](https://qiita.com/hatoo@github/items/fa14ad36a1b568d14f3e)
    /// 入力用マクロ
    #[macro_export]
    macro_rules! get {
        ($t:ty) => {
            {
                let mut line = String::new();
                std::io::stdin().read_line(&mut line).unwrap();
                line.trim().parse::<$t>().unwrap()
            }
        };
        ($($t:ty),*) => {
            {
                let mut line = String::new();
                std::io::stdin().read_line(&mut line).unwrap();
                let mut iter = line.split_whitespace();
                (
                    $(iter.next().unwrap().parse::<$t>().unwrap(),)*
                )
            }
        };
        ($t:ty ; $n:expr) => {
            (0..$n).map(|_|
                get_!($t)
            ).collect::<Vec<_>>()
        };
        ($($t:ty),* ; $n:expr) => {
            (0..$n).map(|_|
                get_!($($t),*)
            ).collect::<Vec<_>>()
        };
        ($t:ty ;;) => {
            {
                let mut line = String::new();
                std::io::stdin().read_line(&mut line).unwrap();
                line.split_whitespace()
                    .map(|t| t.parse::<$t>().unwrap())
                    .collect::<Vec<_>>()
            }
        };
        ($t:ty ;; $n:expr) => {
            (0..$n).map(|_|
                get_!($t ;;)
            ).collect::<Vec<_>>()
        };
    }
}
0