Cod sursa(job #1460121)
| Utilizator | Data | 11 iulie 2015 16:47:54 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
#define P 100003
set<int> B[P];
void insert(int val) {
B[val % P].insert(val);
}
void erase(int val) {
B[val % P].erase(val);
}
bool fnd(int val) {
return B[val % P].find(val) != B[val % P].end();
}
int main() {
int n, t, a;
fin>>n;
while(n--) {
fin>>t>>a;
switch(t) {
case 1: insert(a); break;
case 2: erase(a); break;
case 3: fout<<fnd(a)<<'\n'; break;
}
}
return 0;
}
