fork(39) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <set>
  5. #include <iterator>
  6. using namespace std;
  7.  
  8. int main() {
  9. set<int> s1;
  10. set<int> s2;
  11. vector<int> s3;
  12.  
  13. s1.insert(1);
  14. s1.insert(2);
  15. s1.insert(3);
  16. s1.insert(4);
  17.  
  18. s2.insert(1);
  19. s2.insert(6);
  20. s2.insert(3);
  21. s2.insert(0);
  22.  
  23. set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(), std::back_inserter(s3));
  24. return 0;
  25. }
Success #stdin #stdout 0.02s 2856KB
stdin
Standard input is empty
stdout
Standard output is empty