Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cmath>
- #include <algorithm>
- #include <vector>
- #include <set>
- #include <map>
- #include <stack>
- #include <queue>
- #include <cstdlib>
- #include <cstdio>
- #include <string>
- #include <cstring>
- #include <cassert>
- #include <utility>
- #include <iomanip>
- using namespace std;
- const int MAXN = 1050;
- int n;
- int a[MAXN], b[MAXN];
- int indA[MAXN], indB[MAXN];
- int ans[MAXN];
- int main() {
- //assert(freopen("input.txt","r",stdin));
- //assert(freopen("output.txt","w",stdout));
- scanf("%d", &n);
- for (int i = 1; i <= n; i++) {
- scanf("%d", &a[i]);
- }
- for (int i = 1; i <= n; i++) {
- scanf("%d", &b[i]);
- }
- for (int i = 1; i <= n; i++) {
- indA[i] = i;
- indB[i] = i;
- }
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j < n; j++) {
- if (a[j] > a[j + 1]) {
- swap(a[j], a[j + 1]);
- swap(indA[j], indA[j + 1]);
- }
- }
- }
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j < n; j++) {
- if (b[j] < b[j + 1]) {
- swap(b[j], b[j + 1]);
- swap(indB[j], indB[j + 1]);
- }
- }
- }
- for (int i = 1; i <= n; i++)
- ans[indA[i]] = indB[i];
- for (int i = 1; i <= n; i++)
- printf("%d ", ans[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement