結果

問題 No.2851 Make Pairs
ユーザー NakLon131NakLon131
提出日時 2024-08-25 13:38:11
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 11,690 ms
コンパイル使用メモリ 402,096 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-08-25 13:38:25
合計ジャッジ時間 12,555 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,816 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 11 ms
6,940 KB
testcase_06 AC 11 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    input!{
		n: usize,
		a: [usize; n],
	}

	// 1~nの個数を記録
	let mut cnt_a = vec![0; n+1];
	for &aa in &a {
		cnt_a[aa] += 1;
	}
	
	// 偶数枚ある個数の合計 / 2
	let mut cnt = 0;
	for &x in &cnt_a {
		if x % 2 == 0 {
			cnt += x;
		}
	}
	println!("{}", cnt / 2);
}

// const MOD17: usize = 1000000007;
// const MOD93: usize = 998244353;
// const INF: usize = 1 << 60;
// let dx = vec![!0, 0, 1, 0]; // 上左下右
// let dy = vec![0, !0, 0, 1]; // 上左下右
// let d = vec!{(!0, 0), (0, !0), (1, 0), (0, 1)}; // 上左下右

#[allow(unused)]
use proconio::{input, marker::Chars, marker::Usize1};

#[allow(unused)]
use std::{
	mem::swap,
	cmp::min, cmp::max,
	cmp::Reverse,
	collections::HashSet, collections::BTreeSet,
	collections::HashMap, collections::BTreeMap,
	collections::BinaryHeap,
	collections::VecDeque,
	iter::FromIterator,
};
0