Mai intai trebuie sa te autentifici.
Cod sursa(job #1850902)
Utilizator | Data | 19 ianuarie 2017 00:19:51 | |
---|---|---|---|
Problema | Hashuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.71 kb |
#include <stdio.h>
#include <vector>
#include <algorithm>
#define M 666013
using namespace std;
int i, n, op, x;
vector <int> H[M];
void f(int x, int op)
{
bool ok;
for(int i = 0; i < H[x % M].size(); i++)
if(H[x % M][i] == x)
{
ok = 1;
if(op == 2)
H[x % M].erase(H[x % M].begin() + i);
break;
}
if(op == 1 && !ok) H[x % M].push_back(x);
if(op == 3) printf("%d\n", ok);
}
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
scanf("%d", &n);
for(i = 1; i <= n; i++)
{
scanf("%d%d", &op, &x);
f(x, op);
}
return 0;
}