Ankit_132

B

Jan 10th, 2024
1,134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define ll     long long
  7. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  8.  
  9. int main()
  10. {
  11.     _test
  12.     {
  13.         int n, m;
  14.         cin>>n>>m;
  15.  
  16.         vector<int> a(n), b(m);
  17.  
  18.         for(auto &e: a)
  19.             cin>>e;
  20.         for(auto &e: b)
  21.             cin>>e;
  22.  
  23.         int _max = 0;
  24.  
  25.         for(auto e: b)
  26.             _max = max(_max, e);
  27.  
  28.         sort(a.end()-_max, a.end());
  29.  
  30.         for(auto e: a)
  31.             cout<<e<<" ";
  32.         cout<<"\n";
  33.     }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment