You are viewing a single comment's thread. Return to all comments →
this code will fail the test cases 11 and 12. I know it that because of "if (x == *it)" this line. But I can't understand Why it is.
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <set> #include <algorithm> using namespace std; int main() { long long q,y,x; cin >> q; set<long long>s; set<long long>::iterator it; for (long long i = 0; i < q; i++){ cin >> y >> x; if (y == 1){ s.insert(x); } else if (y == 2){ s.erase(x); } else { it = s.find(x); if (x == *it){ cout << "Yes"<< endl; } else{ cout << "No" << endl; } } } return 0; } >
Seems like cookies are disabled on this browser, please enable them to open this website
Sets-STL
You are viewing a single comment's thread. Return to all comments →