Pagini recente » Cod sursa (job #2671203) | Cod sursa (job #598576) | Rating Cojocaru Vicentiu (CojocaruVicentiu) | Cod sursa (job #338902) | Cod sursa (job #1527001)
#include <iostream>
#include <fstream>
#include <vector>
#define MOD 666013
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n, tip, x, val,t;
vector <int> v[MOD+5];
int main()
{
f>>n;
for (;n;--n)
{
f>>tip>>x;
if (tip == 1)
{
val = x % MOD;
v[val].push_back(x);
}
else if (tip==2)
{
val = x % MOD;
for (vector<int>::iterator it = v[val].begin(); it!=v[val].end();++it)
{
if ((*it)==x)
{
(*it)=v[val].back();
v[val].pop_back();
break;
}
}
}
else
{
t=0;
val = x % MOD;
for (vector<int>::iterator it = v[val].begin(); it!=v[val].end();++it)
if ((*it) == x)
{
t=1;
break;
}
g<<t<<"\n";
}
}
return 0;
}
/*
(1) infoarena.ro/problema/hashuri
(2) infoarena.ro/problema/loto
(3) infoarena.ro/problema/strmatch
(4) infoarena.ro/problema/per
suplimentar:
http://codeforces.com/contest/19/problem/C
(Problema B)- https://github.com/palcu/rotopcoder/raw/master/coliziune/enunturi.pdf
*/