Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- constexpr int NMAX = 1e5 + 3;
- int n, arr1[NMAX], arr2[NMAX];
- int posOfElemIn2nd[NMAX], posOfIthFrom1In2[NMAX];
- void readArr(int arr[NMAX]) {
- for (int i = 1; i <= n; i++) {
- cin >> arr[i];
- }
- }
- void cnt() {
- }
- int main() {
- freopen("text.in", "r", stdin);
- cin >> n;
- readArr(arr1);
- readArr(arr2);
- for (int i = 1; i <= n; i++) {
- posOfElemIn2nd[arr2[i]] = i;
- }
- for (int i = 1; i <= n; i++) {
- posOfIthFrom1In2[i] = posOfElemIn2nd[arr1[i]];
- }
- for (int i = 1; i <= n; i++) {
- cerr << "pos of " << arr1[i] << " in arr2: " << posOfIthFrom1In2[i] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement