Pagini recente » Cod sursa (job #2695642) | Cod sursa (job #1707462) | Cod sursa (job #740603) | Cod sursa (job #3203153) | Cod sursa (job #2252947)
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#define mod 666013
using namespace std;
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
vector<int>v[mod];
int n,op,x;
int main()
{
f>>n;
for(int i=1;i<=n;i++)
{
f>>op>>x;
vector<int>::iterator it = find(v[x%mod].begin(), v[x%mod].end(), x);
switch(op)
{
case 1:
{
if(it == v[x%mod].end())
v[x%mod].push_back(x);
}
break;
case 2:
{
if(it!=v[x%mod].end())
{
*it = v[x%mod][v[x%mod].size()-1];
v[x%mod].pop_back();
}
}
break;
case 3:
{
if(it != v[x%mod].end())
g<<1<<"\n";
else
g<<0<<"\n";
}
break;
}
}
return 0;
}