結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー maromimaromi
提出日時 2024-05-18 18:49:30
言語 Rust
(1.77.0 + proconio)
結果
TLE  
実行時間 -
コード長 735 bytes
コンパイル時間 12,697 ms
コンパイル使用メモリ 401,400 KB
実行使用メモリ 8,864 KB
最終ジャッジ日時 2024-05-18 18:49:51
合計ジャッジ時間 18,556 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 4 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 5 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::str::FromStr;
use std::{io::*, vec};
fn main() {
	let n: usize = read();
	let mut count = 0;
	let mut a = vec![0; n];
	for _i in &mut a {
		*_i = read();
	}
	let mut dp = vec![false; 100000];
	dp[0] = true;
	for _ in 0..n {
		for _i in 0..100000 {
			for _j in &mut a {
				if dp[_i] {
					dp[_i ^ *_j] = true;
				}
			}
		}
	}
	for _i in &mut dp {
		if *_i {
			count += 1;
		}
	}
	println!("{}", count);
}

pub fn read<T: FromStr>() -> T {
	let stdin = stdin();
	let stdin = stdin.lock();
	let token: String = stdin
		.bytes()
		.map(|c| c.expect("failed to read char") as char)
		.skip_while(|c| c.is_whitespace())
		.take_while(|c| !c.is_whitespace())
		.collect();
	token.parse().ok().expect("failed to parse token")
}
0