Pagini recente » Borderou de evaluare (job #3198712) | Rezultatele filtrării | Diferente pentru problema/segmente2 intre reviziile 10 si 5 | Borderou de evaluare (job #989) | Cod sursa (job #3198917)
#include <iostream>
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <set>
using namespace std;
#define NR 100003
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<set<int>> multime;
int main()
{
int n, instr, val;
fin >> n;
multime.resize(NR);
for(int i = 1; i <= n; ++i){
fin >> instr >> val;
switch(instr){
case 1:{
int hashh = val % NR;
multime[hashh].insert(val);
break;
}
case 2:{
int hashh = val % NR;
multime[hashh].erase(val);
break;
}
case 3:{
int hashh = val % NR;
auto it = multime[hashh].find(val);
if(it == multime[hashh].end())
fout << 0 << '\n';
else fout << 1 << '\n';
break;
}
}
}
return 0;
}