Mai intai trebuie sa te autentifici.
Cod sursa(job #2415599)
| Utilizator | Data | 26 aprilie 2019 12:21:49 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 1.2 kb |
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int MOD = 666013;
int N;
vector <int> v[MOD + 5];
int main()
{
fin >> N;
int type, x;
for(int i = 1; i <= N; i++)
{
fin >> type >> x;
if(type == 1)
{
bool found = false;
for(auto it : v[x % MOD])
if(it == x)
{
found = true;
break;
}
if(!found)
v[x % MOD].push_back(x);
}
else if(type == 2)
{
vector <int> aux;
for(auto it : v[x % MOD])
if(it != x)
aux.push_back(it);
v[x % MOD] = aux;
}
else
{
bool found = false;
for(auto it : v[x % MOD])
if(it == x)
{
found = true;
break;
}
if(found)
fout << 1 << '\n';
else
fout << 0 << '\n';
}
}
return 0;
}
