Mai intai trebuie sa te autentifici.
Cod sursa(job #2214546)
Utilizator | Data | 19 iunie 2018 12:59:52 | |
---|---|---|---|
Problema | Hashuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.55 kb |
#include <fstream>
#include <map>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
const int MOD = 666013;
const int MAXN = 1e6;
map <int, int>dict[MOD + 2];
int n;
int main() {
in >> n;
while (n --) {
int q, nr;
in >> q >> nr;
if (q == 1) {
dict[nr % MOD][nr] = 1;
}
if (q == 2) {
if (dict[nr % MOD].count(nr))
dict[nr % MOD].erase(nr);
}
if (q == 3) {
if (dict[nr % MOD].count(nr))
out << 1 << '\n';
else
out << 0 << '\n';
}
}
return 0;
}