Advertisement
deushiro

Untitled

Feb 9th, 2020
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. #include <set>
  5. #include <cmath>
  6. #include <map>
  7. #include <string>
  8. #include <fstream>
  9. #include <queue>
  10.  
  11. using namespace std;
  12.  
  13.  
  14. typedef long long ll;
  15.  
  16.  
  17. int main()
  18. {
  19.     ios_base::sync_with_stdio(false);
  20.     cin.tie(0);
  21.     cout.tie(0);
  22.     int tt;
  23.     cin >> tt;
  24.     while (tt--) {
  25.         int n;
  26.         cin >> n;
  27.         vector <int> a(n * 2);
  28.         for (int i = 0; i < n * 2; ++i) {
  29.             cin >> a[i];
  30.         }
  31.         sort(a.begin(), a.end());
  32.         cout << a[n] - a[n - 1] << endl;
  33.     }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement