結果

問題 No.29 パワーアップ
ユーザー msm1993
提出日時 2020-03-22 12:46:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 1,755 ms
コンパイル使用メモリ 167,376 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 17:11:43
合計ジャッジ時間 2,657 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
	int N;
	cin >> N;
	vector<int> item( 10 );
	for( int i = 0; i < N; i++ ) {
		int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		c--;
		item[a]++;
		item[b]++;
		item[c]++;
	}

	int ans = 0;
	for( int i = 0; i < 10; i++ ) {
		ans += item[i] / 2;
		item[i] %= 2;
	}
	int cnt = 0;
	for( int i = 0; i < 10; i++ ) {
		cnt += item[i];
	}
	ans += cnt / 4;

	cout << ans << endl;
}
0