Advertisement
STANAANDREY

Untitled

May 7th, 2023
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. constexpr int NMAX = 1e5 + 3;
  4. int n, arr1[NMAX], arr2[NMAX];
  5. int posOfElemIn2nd[NMAX], posOfIthFrom1In2[NMAX];
  6.  
  7. void readArr(int arr[NMAX]) {
  8. for (int i = 1; i <= n; i++) {
  9. cin >> arr[i];
  10. }
  11. }
  12.  
  13. void cnt() {
  14.  
  15. }
  16.  
  17. int main() {
  18. freopen("text.in", "r", stdin);
  19. cin >> n;
  20. readArr(arr1);
  21. readArr(arr2);
  22.  
  23. for (int i = 1; i <= n; i++) {
  24. posOfElemIn2nd[arr2[i]] = i;
  25. }
  26. for (int i = 1; i <= n; i++) {
  27. posOfIthFrom1In2[i] = posOfElemIn2nd[arr1[i]];
  28. }
  29. for (int i = 1; i <= n; i++) {
  30. cerr << "pos of " << arr1[i] << " in arr2: " << posOfIthFrom1In2[i] << endl;
  31. }
  32.  
  33. return 0;
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement