#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main() {
int n;
set<int>Myset;
cin >> n;
while(n--){
int x,y;
cin >> y >> x;
if(y == 1){
Myset.insert(x);
} else if(y == 2){
Myset.erase(x);
} else {
auto itr = Myset.find(x);
if(distance(itr,Myset.end()) == 0){
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
}
return 0;
}
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main() {
int n;
set<int>Myset;
cin >> n;
while(n--){
int x,y;
cin >> y >> x;
if(y == 1){
Myset.insert(x);
} else if(y == 2){
Myset.erase(x);
} else {
auto itr = Myset.find(x);
if(distance(itr,Myset.end()) == 0){
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
}
return 0;
}
85 % working
ReplyDeletecode plz
ReplyDelete#include
ReplyDelete#include
#include
using namespace std;
int main(){
int size;
cin>>size;
sets;
int length=s.size();
while(size--){
int n{},x{};
cin>>n>>x;
if(n==1){
s.insert(x);
}else if(n==2){
s.erase(x);
}else{
auto it=find(s.begin(),s.end(),x);
if(it!=s.end())
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
}
return 0;
}
algorithm
Deleteiostream
set
#include
ReplyDelete#include
#include
#include
#include
#include
using namespace std;
int main() {
int n;
sets;
cin >> n;
while(n--){
int x,y;
cin >> y >> x;
if(y == 1){
s.insert(x);
} else if(y == 2){
s.erase(x);
} else {
auto itr = s.find(x);
if(distance(itr,s.end()) == 0){
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
}
return 0;
}
Deletecmath
Deletecstdio
vector
iostream
algorithm
set
100% working
Deletenot working
Delete