結果

問題 No.29 パワーアップ
ユーザー ShopetanShopetan
提出日時 2017-07-12 00:40:37
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,629 bytes
コンパイル時間 1,355 ms
使用メモリ 3,616 KB
最終ジャッジ日時 2022-11-30 20:01:30
合計ジャッジ時間 3,342 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,440 KB
testcase_01 AC 1 ms
3,584 KB
testcase_02 AC 2 ms
3,504 KB
testcase_03 AC 1 ms
3,564 KB
testcase_04 AC 2 ms
3,544 KB
testcase_05 AC 2 ms
3,584 KB
testcase_06 AC 2 ms
3,592 KB
testcase_07 AC 2 ms
3,508 KB
testcase_08 AC 1 ms
3,596 KB
testcase_09 AC 1 ms
3,588 KB
testcase_10 AC 2 ms
3,504 KB
testcase_11 AC 1 ms
3,588 KB
testcase_12 AC 1 ms
3,596 KB
testcase_13 AC 2 ms
3,596 KB
testcase_14 AC 1 ms
3,436 KB
testcase_15 AC 2 ms
3,588 KB
testcase_16 AC 2 ms
3,616 KB
testcase_17 AC 1 ms
3,612 KB
testcase_18 AC 2 ms
3,440 KB
testcase_19 AC 2 ms
3,616 KB
testcase_20 AC 2 ms
3,440 KB
testcase_21 AC 1 ms
3,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# include <bits/stdc++.h>

# define FOR(i,a,b) for (int i=(a);i<(b);i++)
# define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
# define REP(i, n) for (int i = 0; i < (int)(n); i++)
# define RREP(i,n) for (int i=(n)-1;i>=0;i--)

# define int(x) int x; scanf("%d",&x);
# define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
# define string(x) string x; cin >> x;

using namespace std;

namespace utils{
  template <typename T> void print(vector<vector<T>> mat) {
    REP (i, mat.size()) {
      REP (j, mat[0].size()) cout << mat[i][j] << ' ';
      cout << endl;
    }
  }

  template <typename T> void print(vector<T> v) {
    REP (i, v.size())
      if (i >= v.size()-1)
	cout << v[i];
      else
	cout << v[i] << ' ';
    
    cout << endl;
  }

  template <typename T> pair<T, T> shape(vector<vector<T>> mat) {
    int d1, d2;

    d1 = mat.size();
    if (d1 > 0) d2 = mat[0].size();
    else int d2 = 0;
    cout << "(" << d1 << ", " << d2 << ")" << endl;
    return make_pair(0, 0);
  }

  template <typename T> vector<vector<T>> empty(int n, int m) {
    vector<vector<T>> mat(n, vector<T>(m));
    return mat;
  }
}

struct Power{
  int num;
  int power;
};

int main() {
  int(n);
  Power A[10];
  int cnt = 0;
  int odd = 0;
  
  REP(i,10){
    A[i].num = i+1;
    A[i].power  = 0;
  }
  
  REP(i,n*3){
    int a;
    cin >> a;
    REP(i,10)
      if(A[i].num == a)
	A[i].power++;
  }

  REP(i,10){
    cnt += A[i].power/2;
    if(A[i].power % 2 != 0)      
      odd++;      
  }
  cnt += odd/4;
  /*
  REP(i,9){
    cout << A[i].power << " ";
  }
  cout << A[9].power << endl;
  */
  cout << cnt << endl;
  
}
0