32 lines
454 B
C
32 lines
454 B
C
#include <stdio.h>
|
|
|
|
void swap(int *l, int *r);
|
|
|
|
int main(void) {
|
|
int n;
|
|
scanf("%d", &n);
|
|
|
|
int arr[n];
|
|
for (int i = 0; i < n; i++) {
|
|
scanf("%d", &arr[i]);
|
|
}
|
|
|
|
int tmp;
|
|
for (int i = 0; i < n; i++) {
|
|
scanf("%d", &tmp);
|
|
swap(&arr[i], &arr[tmp]);
|
|
}
|
|
|
|
for (int i = 0; i < n - 1; i++) {
|
|
printf("%d ", arr[i]);
|
|
}
|
|
printf("%d\n", arr[n - 1]);
|
|
return 0;
|
|
}
|
|
|
|
void swap(int *l, int *r) {
|
|
int temp = *l;
|
|
*l = *r;
|
|
*r = temp;
|
|
}
|