Hi
Is the following code correct for ZCO 2010 P2?
https://www.iarcs.org.in/inoi/2010/zco2010/zco2010-2b.php
This code doesn’t seem to work on code blocks. this code on code blocks doesn’t crash nor it gives the output… I give the input and nothing happens. Although when I try to make it work on different IDEs and compilers this code gives the correct output… Why is it happening … Please help somebody…
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int N[5]; for(int i=0;i<5;i++) cin >> N[i];
int sum = N[0]+N[1]+N[2]+N[3]+N[4];
multiset<int> candidates;
for(int i=0;i<sum;i++){
int x;
cin >> x;
candidates.insert(x);
}
int counter = 0;
vector<int> done;
for(int x: candidates){
if(find(done.begin(),done.end(),x)!=done.end()) continue;
if(candidates.count(x)>2)
counter++;
done.push_back(x);
}
cout << counter;
return 0;
}