Cod sursa(job #2472465)
| Utilizator | Data | 12 octombrie 2019 13:37:19 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
#define Mod 666013
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
vector <int>V[Mod];
int x,N,Op,p,poz,Ok;
int main()
{
f>>N;
while(N--)
{
f>>Op>>x;p=x%Mod;Ok=0;
for(unsigned k=0;k<V[p].size();k++)
if(V[p][k]==x)Ok=1,poz=k;
vector<int>::iterator it=V[p].begin();
it=it+poz;
if(Op==3)g<<Ok<<"\n";
if(Op==2 and Ok==1)V[p].erase(it);
if(Op==1 and Ok==0)V[p].push_back(x);
}
return 0;
}
