結果

問題 No.29 パワーアップ
ユーザー gotutiyan
提出日時 2017-09-30 11:14:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 562 bytes
コンパイル時間 569 ms
コンパイル使用メモリ 69,780 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-15 20:42:51
合計ジャッジ時間 1,416 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int mmax(int a, int b) {
	int x = (a > b) ? a : b;
	return x;
}

int mmin(int a, int b) {
	int x = (a < b) ? a : b;
	return x;
}

int main() {
	int n;
	cin >> n;

	int count[10] = {0};
	for (int i = 0; i < n; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--; c--;
		count[a]++; count[b]++; count[c]++;
	}
	int amari = 0,ans=0;
	for (int i = 0; i < 10; i++) {
		amari += count[i] % 2;
		ans += count[i] / 2;
	}

	cout << ans + amari / 4 << endl;
	return 0;
}
0