Cod sursa(job #2734783)
| Utilizator | Data | 1 aprilie 2021 13:05:40 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 1.08 kb |
#include <bits/stdc++.h>
#define mod 700001
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int> h[mod];
int n;
int main()
{
int i, j, op, x, da;
fin >> n;
for(i = 1; i <= n; i++)
{
fin >> op;
fin >> x;
if(op == 1)
h[x % mod].push_back(x);
if (op == 2)
{
da = 0;
for(j = 0; j < h[x % mod].size(); j++)
if(x == h[x][j])
{
da = 1;
break;
}
if(da == 1)
{
swap(h[x][j], h[x][h[x].size() - 1]);
h[x].pop_back();
}
}
if(op == 3)
{
da = 0;
for(j = 0; j < h[x % mod].size(); j++)
if(x == h[x][j])
{
da = 1;
break;
}
if(da == 1)
fout << "1\n";
else fout << "0\n";
}
}
return 0;
}
