Cod sursa(job #2555159)
Utilizator | Codrut Copas Codrut112 | Data | 23 februarie 2020 19:06:14 |
---|---|---|---|
Problema | Hashuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.77 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n,i,op,rest,j,x,ok;
vector<int>v[666014];
int main()
{
f>>n;
for(i=1; i<=n; i++)
{
f>>op>>x;
rest=x%666013;
if(op==1) v[rest].push_back(x);
if(op==2)
{
for(j=0; j<v[rest].size(); j++)
if(v[rest][j]==x)
{
swap(v[rest][j],v[rest][v[rest].size()-1]);
v[rest].pop_back();
}
}
if(op==3)
{
ok=0;
for(j=0; j<v[rest].size(); j++)
if(v[rest][j]==x)
ok=1;
g<<ok<<'\n';
}
}
}