Cod sursa(job #1862329)

Utilizator adystar00Bunea Andrei adystar00 Data 29 ianuarie 2017 19:37:29
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.89 kb
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
const int mod= 66013;
vector <int> g[1000001];
int main()
{
    ifstream fin ("hashuri.in");
    ofstream fout ("hashuri.out");
    int i,n,q,x,j,pp,r,s;
    fin>>n;
    for(i=1;i<=n;i++)
    {
        fin>>q>>x;
        if(q==1)
            {
                r=x%mod;
                g[r].push_back(x);
            }
        if(q==2)
            {
                r=x%mod;
                s=g[r].size();
                for(j=0;j<s;j++)
                    if(g[r][j]==x)
                        g[r][j]=-1;
            }
        if(q==3)
            {
                r=x%mod;
                s=g[r].size();
                pp=0;
                for(j=0;j<s;j++)
                    if(g[r][j]==x)
                    pp=1;
                fout<<pp<<"\n";
            }
    }
    return 0;
}