Cod sursa(job #2194099)

Utilizator bigmixerVictor Purice bigmixer Data 12 aprilie 2018 12:00:02
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 1.06 kb
#include <bits/stdc++.h>
#define ll long long
#define sz size
#define pb push_back
#define er erase
#define in insert
#define fr first
#define sc second
#define mp make_pair
#define pi pair
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
#define rc(s) return cout<<s,0
const int mod=1e9+7;
const int inf=1e5;
const int huh=6e5;
using namespace std;

vector<int>lel[huh];
int n,x;
char t;
bool lol;

signed main(){
    ifstream fin("hashuri.in");
    ofstream fout("hashuri.out");
    fin >> n;
    for(int i=1;i<=n;i++){
        fin >> t >> x;
        if(t=='1'){
        lel[x%huh].push_back(x); }
        if(t=='2'){
           for(int j=0;j<lel[x%huh].size();j++){
               if(lel[x%huh][j]==x) lel[x%huh].erase(lel[x%huh].begin()+j-1);
           }

        }
        if(t=='3'){
            lol=true;
            for(int j=0;j<lel[x%huh].size();j++){
                if(lel[x%huh][j]==x){ lol=false; fout<<1<<endl; break; }
            }
            if(lol==true) fout<<0<<endl;
        }

    }
}