-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsets-stl.cpp
38 lines (36 loc) · 832 Bytes
/
sets-stl.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
set<int> st;
int Q;
cin >> Q;
for (int i = 0; i < Q; i++) {
int x, y;
cin >> x >> y;
if (x == 1) {
st.insert(y);
}
else if (x == 2) {
set<int>::iterator itr = st.find(y);
if (itr != st.end()) {
st.erase(y);
}
}
else if (x == 3) {
set<int>::iterator itr = st.find(y);
if (itr != st.end()) {
cout << "Yes" << endl;
}
else {
cout << "No" << endl;
}
}
}
return 0;
}