Cod sursa(job #2282869)

Utilizator mihnea.anghelMihnea Anghel mihnea.anghel Data 14 noiembrie 2018 17:29:46
Problema Hashuri Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.64 kb
#include <fstream>
#include <vector>

#define mod 666013

using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int i,j,n,ok,pas,operatie,x;
vector <int> v[mod];

int main()
{
    f>>n;
    for(pas=1;pas<=n;pas++)
    {
        f>>operatie>>x;
        ok=0;
        for(j=0;j<v[x%mod].size();j++)
            if(v[x%mod][j]==x)
            {
                ok=1;
                break;
            }
        if(operatie==1&&ok==0)
            v[x%mod].push_back(x);
        if(operatie==2&&ok==1)
            v[x%mod].pop_back();
        if(operatie==3)
            g<<ok<<endl;
    }
    return 0;
}