Ankit_132

A

Aug 12th, 2023
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll     long long
  6. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  7. #define ff     first
  8. #define ss     second
  9. #define pb     push_back
  10.  
  11. int main()
  12. {
  13.     ios_base::sync_with_stdio(false);
  14.     cin.tie(NULL);
  15.     cout.tie(NULL);
  16.  
  17.     _test
  18.     {
  19.         int n;
  20.         cin>>n;
  21.  
  22.         vector<int> a(n);
  23.         for(auto &e: a)     cin>>e;
  24.  
  25.         sort(a.begin(), a.end());
  26.  
  27.         int f = 0;
  28.  
  29.         for(int i=0; !f && i<n-1; i++)
  30.         {
  31.             if(a[i] != a[i+1])
  32.             {
  33.                 f = 1;
  34.  
  35.                 cout<<i+1<<" "<<n-i-1<<"\n";
  36.  
  37.                 for(int j=0; j<=i; j++)
  38.                     cout<<a[j]<<" ";
  39.                 cout<<"\n";
  40.  
  41.                 for(int j=i+1; j<n; j++)
  42.                     cout<<a[j]<<" ";
  43.                 cout<<"\n";
  44.             }
  45.         }
  46.  
  47.         if(!f)
  48.             cout<<-1<<"\n";
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment