結果

問題 No.29 パワーアップ
ユーザー kyo1
提出日時 2020-03-08 05:11:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 439 bytes
コンパイル時間 1,629 ms
コンパイル使用メモリ 167,364 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 07:28:15
合計ジャッジ時間 2,393 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> cnts(10, 0);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      int a;
      cin >> a;
      cnts[a - 1]++;
    }
  }
  int res = 0, pool = 0;
  for (int i = 0; i < 10; i++) {
    res += cnts[i] / 2;
    pool += cnts[i] % 2;
  }
  cout << res + pool / 4 << '\n';
  return 0;
}
0