Cod sursa(job #1412306)

Utilizator ovidiustiruOvidiu Ioan Stiru ovidiustiru Data 1 aprilie 2015 11:19:04
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.67 kb
#include <fstream>
#include <vector>
#include <map>

using namespace std;

#define modullo 49157


    ifstream fin("hashuri.in");
    ofstream fout("hashuri.out");

vector<map<short,bool> > v(modullo);


void hin(short r,short c){
    v[r][c]=1;
}

void hout(short r, short c){
    v[r].erase(c);
}



int main()
{
    int n,x;
    short k,c,r;
    fin>>n;
    for(int i=0;i<n;i++){

        fin>> k>> x;
        r=x%modullo;
        c=x/modullo;
        if(k==1)hin(r,c);
        else if(k==2)hout(r,c);
        else{
            if(v[r].find(c)!=v[r].end())fout<<"1"<<'\n';
            else fout<<'0'<<'\n';
        }

    }
    return 0;
}