fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here'
  6. int arr[]={1,1,2,2};
  7. int n=2;
  8. pair<int,int>p;
  9. int count[n]={0};
  10. vector<int>res;
  11. for(int i=0;i<n+2;i++)
  12. {
  13. if(count[arr[i]]==1)
  14. {
  15. res.push_back(arr[i]);
  16. }
  17. else count[arr[i]]++;
  18. }
  19. p.first=res[0];
  20. p.second=res[1];
  21. cout<<p.first<<endl<<p.second;
  22. return 0;
  23. }
Success #stdin #stdout 0s 4976KB
stdin
Standard input is empty
stdout
1
2