結果

問題 No.29 パワーアップ
ユーザー seaca
提出日時 2019-01-06 18:15:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 440 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 64,156 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-23 23:58:49
合計ジャッジ時間 1,400 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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