結果

問題 No.2851 Make Pairs
ユーザー KKT89
提出日時 2024-09-21 14:35:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 2,103 ms
コンパイル使用メモリ 197,876 KB
最終ジャッジ日時 2025-02-24 11:15:57
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    set<int> st;
    int res = 0;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        if (st.find(a) == st.end()) {
            st.insert(a);
        } else {
            res += 1;
            st.erase(a);
        }
    }
    cout << res << endl;
}
0