Cod sursa(job #822293)

Utilizator thesilverhand13FII Florea Toma Eduard thesilverhand13 Data 23 noiembrie 2012 10:17:45
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.95 kb
 # include <fstream>
 # include <cstring>
 # include <algorithm>
 # include <vector>

 # define dim 666013
 # define mod 666013


 using namespace std;

 ifstream f("hashuri.in");
 ofstream g("hashuri.out");

 vector < int > a[ dim ];
 int N;

 void adauga( int x )
 {
     if( a[ x % mod ].size() == 0 )
        a[ x % mod ].push_back( x );
 }

 void sterge( int x )
 {
     if ( a[ x % mod ].size() != 0 )
        a[ x % mod ].pop_back();
 }

 void afiseaza( int x )
 {
     if ( a[ x % mod ].size() != 0 )
        g << 1 << "\n";
     else
        g << 0 << "\n";
 }


 void citire()
 {
     int op, x, i;
     f >> N;
     for ( i = 1 ; i <= N ; i++ )
     {
         f >> op >> x;
         if ( op == 1 )
            adauga( x );
         else
         if ( op == 2 )
            sterge( x );
         else
         if ( op == 3 )
            afiseaza( x );
     }
 }

 int main()
 {
     citire();

 }