Pagini recente » Monitorul de evaluare | Monitorul de evaluare | Monitorul de evaluare | Cod sursa (job #1330448) | Cod sursa (job #2772078)
#include <iostream>
#include <fstream>
#include <vector>
#define MOD 133733
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
vector <int> h[MOD];
int qcnt, found;
int tip, x;
int main (){
fin>>qcnt;
for(int query=1; query<=qcnt; query++){
fin>>tip>>x;
if(tip == 1){
found=0;
for(int i=0; i<h[x%MOD].size(); i++)
if(h[x%MOD][i] == x){
found=1;
break;
}
if(found == 0)
h[x%MOD].push_back(x);
}else if(tip == 2){
found=-1;
for(int i=0; i<h[x%MOD].size(); i++)
if(h[x%MOD][i] == x){
found=i;
break;
}
if(found != -1)
h[x%MOD].erase(h[x%MOD].begin() + found);
}else{
found=0;
for(int i=0; i<h[x%MOD].size(); i++)
if(h[x%MOD][i] == x){
found=1;
break;
}
fout<<found<<"\n";
}
}
return 0;
}