Mai intai trebuie sa te autentifici.
Cod sursa(job #2221330)
Utilizator | Data | 13 iulie 2018 19:14:32 | |
---|---|---|---|
Problema | Hashuri | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.9 kb |
#include <fstream>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
map<int, vector<int> > sir;
int main()
{
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n;
fin >> n;
int op, x, theta = 258283;
for(int i = 1; i <= n; ++i){
fin >> op >> x;
if(op == 1)
sir[x % theta].push_back(x);
if(op == 2){
for(int i = 0; i < sir[x % theta].size(); ++i){
if(sir[x % theta][i] == x){
sir[x % theta].erase(sir[x % theta].begin() + i);
break;
}
}
}
if(op == 3){
bool exista = 0;
for(int i = 0; i < sir[x % theta].size() && !exista; ++i){
if(sir[x % theta][i] == x)
exista = 1;
}
fout << exista << "\n";
}
}
return 0;
}