結果

問題 No.29 パワーアップ
ユーザー Kome_soudou
提出日時 2022-10-31 17:30:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 458 bytes
コンパイル時間 1,648 ms
コンパイル使用メモリ 173,844 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 05:57:44
合計ジャッジ時間 2,256 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n, a, b, c;
	cin >> n;
	map<int, int> mp;
	for(int i = 0; i < n; i++)
	{
		cin >> a >> b >> c;
		if(mp.count(a)) mp.at(a)++;
		else mp[a] = 1;
		if(mp.count(b)) mp.at(b)++;
		else mp[b] = 1;
		if(mp.count(c)) mp.at(c)++;
		else mp[c] = 1;
	}
	
	int ans = 0;
	int cnt = 0;
	for(auto v : mp)
	{
		ans += v.second / 2;
		cnt += v.second % 2;
	}
	ans += cnt / 4;
	cout << ans << endl;
	return 0;
}
0