-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA.cpp
37 lines (34 loc) · 810 Bytes
/
A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <bits/stdc++.h>
using namespace std;
namespace Util {
#ifdef LOCAL
#define dbg(a) cerr << __LINE__ << " \"" << #a << "\": " << a << '\n'
#else
#define dbg(a)
#endif
#define all(v) (v).begin(), (v).end()
using ll = long long;
}
using namespace Util;
int constexpr N = (int) 2.1e5;
signed main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
for (auto &i : a) cin >> i;
vector<int> b(n);
for (auto &i : b) cin >> i;
sort(all(a), greater<int>());
vector<int> idx(n);
iota(all(idx), 0);
sort(all(idx), [&](auto &lhs, auto &rhs) {
return b[lhs] < b[rhs];
});
vector<int> ans(n);
for (int i = 0; i < n; ++i) {
ans[idx[i]] = a[i];
}
for (auto &i : ans) cout << i << ' ';
return 0;
}