Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <algorithm>
- using namespace std;
- #define pii pair <int,int>
- void cv(vector <int> v) {
- for (int i: v) {
- cout << i << ' ';
- } cout << "\n";
- }
- bool cmp(pii a, pii b) {
- return a.first < b.first;
- }
- //https://codeforces.com/problemset/problem/1833/B
- void f() {
- int n,k; cin >> n >> k;
- vector <pii> a(n);
- vector <int> b(n);
- for (int i = 0; i < n; ++i) {
- int x; cin >> x;
- a[i].first = x;
- a[i].second = i;
- }
- sort(a.begin(), a.end(), cmp);
- for (int &i: b) cin >> i;
- vector <int> ans;
- for (int i = 0; i < n; ++i) {
- ans[i] = b[i];
- }
- cv(ans);
- }
- int main()
- {
- int t; cin >> t;
- for (int go = 0; go < t; ++go) {
- f();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement