Skip to content

Instantly share code, notes, and snippets.

@likecs likecs/geek03.cpp
Last active Nov 20, 2017

Embed
What would you like to do?
Model Solution of GEEK03
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int t, n;
cin >> t;
assert(1 <= t && t <= 10);
while(t--) {
cin >> n;
assert(1 <= n && n <= 100);
vector<string> a(n);
for(int i = 0; i < n; ++i) {
cin >> a[i];
assert(a[i].length() <= 10);
}
sort(a.begin(), a.end());
int ans = 0;
for(int i = 0; i < n; ++i) {
int j = i;
while(j < n && a[i] == a[j]) {
j += 1;
}
if ((j - i) % 2 == 1) {
ans += 1;
}
i = j - 1;
}
cout << ans << "\n";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.