Pagini recente » Cod sursa (job #441580) | Cod sursa (job #496376) | Cod sursa (job #2893062) | Cod sursa (job #2566772) | Cod sursa (job #2619504)
#include<iostream>
#include<bits/stdc++.h>
#include <fstream>
#include<unordered_map>
#include <queue>
using namespace std;
const int n=200000000;
ifstream f("hashuri.in");
ofstream f1("hashuri.out");
class Hash{
public:
vector<int>h;
Hash(){
h.resize(n);
fill(this->h.begin(),this->h.end(),-1);
}
void tip1(int x);
void tip2(int x);
void tip3(int x);
};
void Hash::tip1(int x){
if (h[n%x]==-1){
h[n%x]=x;
}
}
void Hash::tip2(int x){
if (h[n%x]!=-1){
h[n%x]=-1;
}
}
void Hash::tip3(int x){
if (h[n%x]==x){
f1<<1<<"\n";
cout<<1<<endl;
}
else{
f1<<0<<"\n";
cout<<0<<endl;
}
}
int main(){
Hash * hash =new Hash();
int nr,a,b;
f>>nr;
for (int i=0;i<nr;i++){
f>>a>>b;
if (a==1){
hash->tip1(b);
}
else if (a==2){
hash->tip2(b);
}
else if (a==3){
hash->tip3(b);
}
}
return 0;
}