結果
| 問題 | No.29 パワーアップ | 
| コンテスト | |
| ユーザー |  hiyori | 
| 提出日時 | 2016-09-23 12:19:36 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 653 bytes | 
| コンパイル時間 | 545 ms | 
| コンパイル使用メモリ | 67,192 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-10-24 20:58:57 | 
| 合計ジャッジ時間 | 1,329 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#define REP(i, a) for(int i = 0; i < a; i++)
using namespace std;
/* 同じアイテム2つか任意のアイテム4つでパワーアップ */
int main ()
{
  int N;
  vector<int> items(10, 0);  // 0~9の10種類のアイテム
  cin >> N;
  REP(i, N) {
    REP(j, 3) {
      int get_item;
      cin >> get_item;
      items[get_item-1]++;
    }
  }
  int power_up = 0, cnt = 0;
  REP(i, items.size()) {
    if (items[i] > 1) {
      power_up += items[i] / 2;
      cnt += items[i] % 2;
    }
    else cnt += items[i];
  }
  power_up += cnt / 4;
  cout << power_up << endl;
  return 0;
}
            
            
            
        