結果

問題 No.29 パワーアップ
ユーザー 0w1
提出日時 2016-11-20 11:18:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 431 bytes
コンパイル時間 1,361 ms
コンパイル使用メモリ 167,348 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 06:51:30
合計ジャッジ時間 2,126 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

signed main(){
  int N; cin >> N;
  vector< int > cnt( 10 + 1 );
  for( int i = 0; i < N; ++i ){
    int A, B, C; cin >> A >> B >> C;
    ++cnt[ A ], ++cnt[ B ], ++cnt[ C ];
  }
  int ans = 0, used = 0;
  for( int i = 1; i <= 10; ++i )
    ans += cnt[ i ] / 2, used += cnt[ i ] / 2 * 2, cnt[ i ] = cnt[ i ] / 2 * 2;
  ans += ( N * 3 - used ) / 4;
  cout << ans << endl;
  return 0;
} 
0