Pagini recente » Cod sursa (job #2659355) | Cod sursa (job #2505985) | Cod sursa (job #3263191) | Cod sursa (job #804710) | Cod sursa (job #1212652)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
vector <int> V[1000000];
int isPresent(int x){
for(int i=1; i<V[x % 1000000].size(); i++){
if(V[x%1000000][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%1000000].push_back(x);
}
if(id == 2){
int k = isPresent(x);
if(k > 0) V[x%1000000].erase(V[x%1000000].begin()+k);
}
if(id == 3){
if(isPresent(x)>=0) outFile << 1;
else outFile << 0;
}
}
}