結果

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

ソースコード

diff #

#include <bits/stdc++.h>

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

    int N;
    std::cin >> N;

    std::vector<int> count(N + 1, 0);
    for(int i=0;i<N;i++){
        int A;
        std::cin >> A;

        count[A] += 1;
    }

    int res = 0;
    for(int i=1;i<=N;i++){
        res += count[i] / 2;
    }

    std::cout << res << std::endl;
}
0