Cod sursa(job #1365584)
Utilizator | Data | 28 februarie 2015 13:23:32 | |
---|---|---|---|
Problema | Hashuri | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.57 kb |
#include<iostream>
#include<fstream>
using namespace std;
ofstream g("hashuri.out");
int sir[10000001];
void hashing (int op,int x)
{
if(op==1)
sir[x]++;
if(op==2)
sir[x]--;
if(op==3)
if(sir[x]>0)
g << "1" << "\n";
else if(sir[x]==0)
g << "0" << "\n";
}
void read()
{
int x,n,op;
ifstream f("hashuri.in");
f >> n;
for(int i=1;i<=n;i++)
{
f >> op >> x;
hashing(op,x);
}
f.close();
g.close();
}
int main()
{
read();
return 0;
}