結果

問題 No.29 パワーアップ
ユーザー motxx
提出日時 2014-12-03 03:18:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 500 bytes
コンパイル時間 1,643 ms
コンパイル使用メモリ 158,944 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 14:40:23
合計ジャッジ時間 2,421 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

int main() {
  
  int N; cin >> N;
  vector<int> items(10);
  rep(_, N) {
    int a, b, c;
    cin >> a >> b >> c; a--, b--, c--;
    items[a] ++, items[b] ++, items[c] ++;
  }
  
  int ans = 0;
  int remain = 0;
  rep(i, 10) {
    ans += items[i] / 2;
    remain += items[i] % 2;
  }
  ans += remain / 4;
  
  cout << ans << endl;
  
  return 0;
}
0