結果
問題 | No.2851 Make Pairs |
ユーザー |
![]() |
提出日時 | 2024-08-25 14:10:47 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 100 ms / 2,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 1,368 ms |
コンパイル使用メモリ | 160,868 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-25 14:10:50 |
合計ジャッジ時間 | 2,311 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long int ll;typedef pair<ll,ll> pll;typedef vector<ll> vll;#define repi(i,a,b) for(ll i=a;i<b;i++)#define rep(i,a) repi(i,0,a)#define rrep(i,a) for(ll i=a-1;i>=0;i--)#define MOD 1000000007//debug#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;int main(){ll N;cin >> N;ll A[N];rep(i, N) cin >> A[i];sort(A, A+N);ll ans = 0;ll prev = A[0];ll cnt = 1;repi(i, 1, N) {if (A[i] == prev) {cnt++;if (cnt % 2 == 0) ans++;}else {cnt = 1;}prev = A[i];}cout << ans << endl;return 0;}