結果

問題 No.2851 Make Pairs
ユーザー t98slider
提出日時 2024-08-25 13:32:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 1,918 ms
コンパイル使用メモリ 194,292 KB
最終ジャッジ日時 2025-02-24 00:45:22
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> cnt(n);
    for(int i = 0; i < n; i++){
        int v;
        cin >> v;
        cnt[--v]++;
    }
    int ans = 0;
    for(auto &&v : cnt) ans += v / 2;
    cout << ans << '\n';
}
0