Pagini recente » Cod sursa (job #1779894) | Cod sursa (job #1660912) | Cod sursa (job #1839563) | Cod sursa (job #90711) | Cod sursa (job #2406006)
#include <bits/stdc++.h>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
//-----------------------
//Variabile globale
int n,val[1000001];
vector<pair<int,pair<int,int>>>v;
//-----------------------
//Functii
void citeste();
void rezolva();
//-----------------------
int main()
{
citeste();
return 0;
}
//-----------------------
void rezolva()
{
int last1;
sort(v.begin(),v.end());
for(int i = 0; i < v.size(); ++i)
{
if(v[i].first != v[i-1].first)
{
last1 = -1;
}
if(v[i].second.second == 1)
last1 = 1;
else if(v[i].second.second == 2)
last1 = -1;
else if(last1 == 1)
val[v[i].second.first] = 1;
}
}
//-----------------------
void citeste()
{
int n;
f >> n;
for(int i = 1; i <= n; ++i)
{
int op,a;
f >> op >> a;
v.push_back({a,{i,op}});
}
rezolva();
f.close();
f.open("hashuri.in");
f >> n;
for(int i = 1; i <= n; ++i)
{
int op,a;
f >> op >> a;
if(op == 3)
g << val[i] << '\n';
}
}