Cod sursa(job #2894935)

Utilizator catarau.bianca.Bianca Catarau catarau.bianca. Data 28 aprilie 2022 16:40:46
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.58 kb
#include <fstream>
#include <vector>
#include <algorithm>
 
using namespace std;
#define MOD 666013 
ifstream f("hashuri.in");
ofstream g("hashuri.out");
 
vector<int> h[MOD];
 
int main()
{
    int n;
    f>>n;
    for(int i=1;i<=n;i++)
    {
        int o,x;
        f>>o>>x;
        if(o==1) {h[x % MOD].push_back(x); continue;}
        else if(o==2 && count(h[x % MOD].begin(), h[x % MOD].end(), x)) {h[x % MOD].erase(find(h[x % MOD].begin(), h[x % MOD].end(), x)); continue;}
        else if(o==3)count(h[x % MOD].begin(), h[x % MOD].end(), x)?g<<"1\n":g<<"0\n";
    }
}