Pagini recente » Cod sursa (job #1647875) | Cod sursa (job #2147093) | Cod sursa (job #1999167) | Cod sursa (job #1143429) | Cod sursa (job #2692369)
#include <iostream>
#include<fstream>
#include<vector>
using namespace std;
const int PRIM=666013;
vector<int>v[PRIM];
int main() {
int n, i, x, r, op, ok, val;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
fin>>n;
for(int w=1;w<=n;w++) {
fin>>op>>val;
x=val/PRIM;
r=val%PRIM;
if(op==1) {
ok=0;
for(i=0;i<v[r].size();i++) {
if(v[r][i]==x) {
ok=1;
break;
}
}
if(ok==0) {
v[r].push_back(x);
}
continue;
}
if(op==2) {
for(i=0;i<v[r].size();i++) {
if(v[r][i]==x) {
v[r].erase(v[r].begin()+i);
}
}
continue;
}
if(op==3) {
ok=0;
for(i=0;i<v[r].size();i++) {
if(v[r][i]==x) {
ok=1;
break;
}
}
fout<<ok<<endl;
}
}
return 0;
}