Cod sursa(job #1020413)
Utilizator | Data | 2 noiembrie 2013 00:46:29 | |
---|---|---|---|
Problema | Hashuri | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.56 kb |
#include <fstream>
#include <unordered_map>
#define mod 666013
using namespace std;
int main()
{
int N;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
unordered_map<int, int> hash;
in>>N;
for (int i = 0; i < N; ++i) {
int c, x;
in>>c>>x;
switch(c) {
case 1: hash.insert(make_pair(x%mod, x)); break;
case 2: hash.erase(x%mod); break;
case 3: out<<(hash.find(x%mod) != hash.end())<<"\n"; break;
default: return -1;
}
}
in.close();
out.close();
return 0;
}