結果

問題 No.2851 Make Pairs
ユーザー Daniel KDaniel K
提出日時 2024-08-25 13:42:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 1,062 ms
コンパイル使用メモリ 119,552 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-08-25 13:42:14
合計ジャッジ時間 1,934 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 76 ms
8,832 KB
testcase_03 AC 81 ms
8,960 KB
testcase_04 AC 86 ms
9,344 KB
testcase_05 AC 19 ms
6,944 KB
testcase_06 AC 105 ms
12,800 KB
testcase_07 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility>
#include <sstream>
#include <queue>
#include <queue>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  map<int, int> counts;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int v;
    cin >> v;
    counts[v]++;
  }

  int sum = 0;
  for (const auto &el: counts) {
    sum += el.second / 2;
  }
  cout << sum << endl;

  return 0;
}
0