Pagini recente » Cod sursa (job #167104) | Cod sursa (job #2531666) | Cod sursa (job #1528393) | Monitorul de evaluare | Cod sursa (job #556862)
Cod sursa(job #556862)
#include<fstream>
#include<vector>
#include<cmath>
#define HASH_SIZE 183746
using namespace std;
int hash(int x){
return (int)floor((float)x*0.6162)%HASH_SIZE;}
int main(){
vector<int> h(HASH_SIZE);
int n,d1,d2;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
f>>n;
for(;n;--n){
f>>d1>>d2;
if(d1==1){h[hash(d2)]=d2;}
if(d1==2){h[hash(d2)]=0;}
if(d1==3&&h[hash(d2)]==0)g<<"0\n";
if(d1==3&&h[hash(d2)]!=0)g<<"1\n";}
return 0;}