Cod sursa(job #2282278)
| Utilizator | Data | 13 noiembrie 2018 15:56:14 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.68 kb |
#include <fstream>
#include <vector>
#include <algorithm>
#define MOD 1000007
using namespace std;
ifstream in{"hashuri.in"};
ofstream out{"hashuri.out"};
vector<int> h[MOD];
int main()
{
int k;
in >> k;
while (k--) {
int cod, n;
in >> cod >> n;
auto it = find(h[n % MOD].begin(), h[n % MOD].end(), n);
if (cod == 1) {
if (it == h[n % MOD].end())
h[n % MOD].push_back(n);
}
if (cod == 2) {
if (it != h[n % MOD].end())
h[n % MOD].erase(it);
}
if (cod == 3)
out << (it != h[n % MOD].end()) << '\n';
}
}
