結果

問題 No.29 パワーアップ
ユーザー hotpepsi
提出日時 2015-03-29 00:38:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 958 ms
コンパイル使用メモリ 62,156 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-03 22:30:09
合計ジャッジ時間 1,615 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>

using namespace std;

int main(int argc, char *argv[])
{
  string s;
  getline(cin, s);
  int N = atoi(s.c_str());
  int cnt[16] = {};
  for (int i = 0; i < N; ++i) {
	  getline(cin, s);
	  stringstream ss(s);
	  int a, b, c;
	  ss >> a >> b >> c;
	  cnt[a] += 1;
	  cnt[b] += 1;
	  cnt[c] += 1;
  }
  int ans = 0;
  int c = 0;
  for (int i = 0; i < 16; ++i) {
	  ans += cnt[i] / 2;
	  c += cnt[i] % 2;
  }
  ans += c / 4;
  cout << ans << endl;
  return 0;
}
0