Pagini recente » Cod sursa (job #375366) | Cod sursa (job #655044) | Cod sursa (job #1211548) | Cod sursa (job #2576721) | Cod sursa (job #1212658)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
vector <int> V[50001];
int isPresent(int x){
for(int i=0; i<V[x % 50000].size(); i++){
if(V[x%50000][i]==x) return i;
}
return -1;
}
int main()
{
ifstream inFile("hashuri.in");
ofstream outFile;
outFile.open("hashuri.out");
int N, id, x;
inFile >> N;
for(int i=1; i<=N; i++){
inFile >> id >> x;
if(id == 1){
int k = isPresent(x);
if(k<0) V[x%50000].push_back(x);
}
if(id == 2){
int k = isPresent(x);
if(k >= 0) V[x%50000].erase(V[x%50000].begin()+k);
}
if(id == 3){
if(isPresent(x)>=0) outFile << "1\n";
else outFile << "0\n";
}
}
}