Cod sursa(job #3291590)
| Utilizator | Data | 5 aprilie 2025 10:07:47 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#include <iostream>
#include <fstream>
#include <algorithm>
#include <map>
std::ifstream f("hashuri.in");
std::ofstream g("hashuri.out");
using namespace std;
const int nMax = 1e6 + 5;
int n;
int a[nMax];
map<int,int> m;
int main()
{
f >> n;
for (int i = 1;i <= n;i++){
int x, tip;
f >> tip >> x;
if (tip == 1)m[x]++;
else if (tip == 2)m[x]--;
else (m[x] > 0) ? g << 1 << '\n' : g << 0 << '\n';
}
}
