-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_GamingForces.cpp
52 lines (52 loc) · 1.1 KB
/
A_GamingForces.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define all(v) (v).begin(), (v).end()
#define int long long int
#define lld long double
void solve();
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--)
{
solve();
}
#ifndef ONLINE_JUDGE
cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
#endif
}
void solve()
{
int n;
cin >> n;
int arr[n];
map<int, int> m;
for (int i = 0; i < n; i++)
{
cin >> arr[i];
m[arr[i]]++;
}
int res = 0;
for (auto &it : m)
{
if (it.first != 1)
res += it.second;
else
{
res += (it.second) / 2;
if (it.second % 2 != 0)
res++;
}
}
cout << res << endl;
}