Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<algorithm>
- #include<vector>
- #define max 100000
- typedef unsigned long long int ull;
- using namespace std;
- int main()
- {
- int t,i,j;
- unsigned long int n;
- ull ar[max];
- pair<vector<ull>::iterator,vector<ull>::iterator> bounds;
- cin>>t;
- while(t--)
- {
- cin>>n;
- for( i=0;i<n;i++)
- {
- cin>>ar[i];
- }
- vector<ull> v(ar,ar+n);
- sort (v.begin(), v.end());
- for(j=0;j<n;j++)
- {
- bounds=equal_range (v.begin(), v.end(), ar[j]);
- if(((bounds.second-v.begin())-1)==(bounds.first-v.begin()))
- {
- cout<<ar[j]<<"\n";
- break;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement