Cod sursa(job #2802619)
| Utilizator | Data | 18 noiembrie 2021 15:35:51 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.74 kb |
#include <bits/stdc++.h>
#define mod 40013;
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
unordered_set<int> rest[40013];
int main(){
int n,m,c,x,r,i;
in>>n;
for(i=1;i<=n;++i){
in>>c>>x;
r=x%mod;
if(c==1)
{
if(rest[r].find(x) == rest[r].end())
rest[r].insert(x);
}
else
if(c==2)
{
if(rest[r].find(x) != rest[r].end())
rest[r].erase(x);
}
else
{
if(rest[r].find(x) == rest[r].end())
out<<0<<'\n';
else
out<<1<<'\n';
}
}
}