Pagini recente » Istoria paginii runda/oni_11_12_3 | Istoria paginii runda/aviara_gripa/clasament | Cod sursa (job #2865670) | Cod sursa (job #495571) | Cod sursa (job #2746938)
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <numeric>
#include <sstream>
#include <cmath>
#include <set>
#include <stack>
#include <iomanip>
#include <limits.h>
#include <queue>
#include <fstream>
#include <unordered_set>
#include <unordered_map>
#include <exception>
#include <deque>
#include <string>
using namespace std;
fstream in_file;
fstream out_file;
//#define BigPrime 786433;
int main()
{
in_file.open("hashuri.in");
out_file.open("hashuri.out", ios::out);
set<int> hash;
int n;
in_file >> n;
int operatie, val;
while (n--)
{
in_file >> operatie;
if (operatie == 1)
{
in_file >> val;
val = val;// % BigPrime;
if (hash.find(val) == hash.end())
hash.insert(val);
}
else if (operatie == 2)
{
in_file >> val;
val = val;//% BigPrime;
if (hash.find(val) != hash.end())
hash.erase(val);
}
else
{
in_file >> val;
val = val;// % BigPrime;
if (hash.find(val) != hash.end())
{
out_file << '1' << "\n";
}
else
{
out_file << '0' << "\n";
}
}
}
in_file.close();
out_file.close();
}