結果
問題 | No.29 パワーアップ |
ユーザー |
![]() |
提出日時 | 2016-09-23 12:19:36 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 653 bytes |
コンパイル時間 | 398 ms |
コンパイル使用メモリ | 61,520 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 17:37:41 |
合計ジャッジ時間 | 1,043 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; }