Mai intai trebuie sa te autentifici.
Cod sursa(job #730325)
| Utilizator | Data | 6 aprilie 2012 08:38:59 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.85 kb |
//============================================================================
// Name : HashTables2.cpp
// Author : Petrisor Teodora
// Version :
// Copyright :
// Description : problem hashuri infoarena
//============================================================================
#include <iostream>
#include <fstream>
#include <set>
# define P 16863
using namespace std;
set<int>S[P+10];
int main() {
ifstream input("hashuri.in");
ofstream output("hashuri.out");
int n;
input>>n; // read the number of pairs
int op, x;
for (int i = 0; i < n; i++)
{
input>>op>>x; // read the pair (operation, number)
if(op==1)
S[x%P].insert(x);
if(op==2)
S[x%P].erase(x);
if(op == 3)
{
if(S[x%P].find(x) != S[x%P].end())
output<<"1\n";
else
output<<"0\n";
}
}
return 0;
}