結果
| 問題 | No.29 パワーアップ | 
| コンテスト | |
| ユーザー |  rsk0315 | 
| 提出日時 | 2020-03-15 21:56:34 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 402 bytes | 
| コンパイル時間 | 419 ms | 
| コンパイル使用メモリ | 57,384 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-10-24 21:13:30 | 
| 合計ジャッジ時間 | 1,153 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%zu", &n);
      |   ~~~~~^~~~~~~~~~~
main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |     scanf("%zu", &j);
      |     ~~~~~^~~~~~~~~~~
            
            ソースコード
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <vector>
int main() {
  size_t n;
  scanf("%zu", &n);
  n *= 3;
  std::vector<int> a(11, 0);
  for (size_t i = 0; i < n; ++i) {
    size_t j;
    scanf("%zu", &j);
    ++a[j];
  }
  int res = 0;
  for (auto& ai: a) {
    res += ai / 2;
    ai %= 2;
  }
  res += std::accumulate(a.begin(), a.end(), 0) / 4;
  printf("%d\n", res);
}
            
            
            
        