Pagini recente » Cod sursa (job #734288) | Cod sursa (job #2272467) | Cod sursa (job #3126426) | Cod sursa (job #957933) | Cod sursa (job #3291590)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <map>
std::ifstream f("hashuri.in");
std::ofstream g("hashuri.out");
using namespace std;
const int nMax = 1e6 + 5;
int n;
int a[nMax];
map<int,int> m;
int main()
{
f >> n;
for (int i = 1;i <= n;i++){
int x, tip;
f >> tip >> x;
if (tip == 1)m[x]++;
else if (tip == 2)m[x]--;
else (m[x] > 0) ? g << 1 << '\n' : g << 0 << '\n';
}
}