Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <string>
- using namespace std;
- int main()
- {
- ifstream cin("set.in");
- ofstream cout("set.out");
- string s;
- vector <vector<int>> a(1e6 + 7);
- int t;
- bool flag;
- while (cin >> s)
- {
- cin >> t;
- if (s[0] == 'i')
- {
- flag = false;
- for (int i = 0; i < a[abs(t) % 1000007].size(); i++)
- if (a[abs(t) % 1000007][i] == t) flag = true;
- if(flag==false)
- a[abs(t) % 1000007].push_back(t);
- }
- else if (s[0] == 'e')
- {
- flag = false;
- for (int i = 0; i < a[abs(t) % 1000007].size(); i++)
- if (a[abs(t) % 1000007][i] == t) { flag=true; break; }
- if (flag)
- cout << "true\n";
- else
- cout << "false\n";
- }
- else if (s[0] == 'd')
- {
- for (auto i = a[abs(t) % 1000007].begin(); i != a[abs(t) % 1000007].end(); i++)
- if (*i == t) {
- a[abs(t) % 1000007].erase(i);
- break;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement