Advertisement
jakaria_hossain

codeforces - phoenix and beauty

May 1st, 2020
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
  5. int main()
  6. {
  7.     ll t ;
  8.     cin>> t;
  9.     while(t--)
  10.     {
  11.         ll n, k;
  12.         cin>>n>>k;
  13.         set<ll>s;
  14.         for(ll i = 0; i<n; i++)
  15.         {
  16.             ll x;
  17.              cin >> x;
  18.              s.insert(x);
  19.         }
  20.         //s.unique();
  21.         //cout<<"Test "<< s.size()<<endl;
  22.         if(s.size()>k)
  23.         {
  24.             cout<<"-1"<<endl;
  25.             continue;
  26.         }
  27.         else
  28.         {
  29.             cout<<n*k<<endl;
  30.  
  31.             for(ll i=0 ; i<n; i++)
  32.             {
  33.                 for(auto x: s)cout<<x<<" ";
  34.                 for(ll i =0 ;i<k-s.size();i++)
  35.                 {
  36.                     cout<<"1 ";
  37.                 }
  38.             }
  39.             cout<<endl;
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement