結果

問題 No.29 パワーアップ
ユーザー yudedako
提出日時 2016-03-20 20:17:44
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 396 bytes
コンパイル時間 623 ms
コンパイル使用メモリ 54,772 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-01 12:07:12
合計ジャッジ時間 1,432 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <array>
int main() {
	int n;
	std::cin >> n;
	std::array<int, 10> array{ 0 };
	for (; n > 0; --n) {
		int a, b, c;
		std::cin >> a >> b >> c;
		++array[a - 1]; ++array[b - 1]; ++array[c - 1];
	}
	int sum = 0;
	int odd = 0;
	for (const auto &item : array) {
		sum += item >> 1;
		if ((item & 1) == 1) ++odd;
	}
	std::cout << sum + (odd >> 2) << std::endl;
	return 0;
}
0