結果

問題 No.29 パワーアップ
コンテスト
ユーザー seaca
提出日時 2019-01-06 18:15:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 440 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 63,024 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-24 21:08:41
合計ジャッジ時間 1,251 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(void){
  int n, cnt[10],tot,ans;
  
  cin >> n;
  tot=0;
  for (int i=0; i<10; i++) cnt[i]=0;
  for (int i=0; i<n; i++){
    int a,b,c;
    cin >> a >> b >> c;
    cnt[a-1]++; cnt[b-1]++; cnt[c-1]++;
    tot += 3;
  }
  ans = 0;
  for (int i=0; i<10; i++){
    if (cnt[i]>=2){
      tot -= cnt[i]/2*2;
      ans += cnt[i]/2;
    }
  }
  ans += tot/4;  
  cout << ans << endl;
  return 0;
}
0