#include <stdio.h> #include <stdlib.h> int compare(const void* a, const void* b) { const int* intA = (int*)a; const int* intB = (int*)b; return *intA - *intB; } int main() { int num1, num2; scanf("%d", &num1); int* arr1 = (int*)malloc(num1 * sizeof(int)); for(int i = 0; i < num1; i++) scanf("%d", &arr1[i]); // for(int i = 0; i < num1; i++) { // printf("arr1[%d] = %d\n", i, arr1[i]); // } scanf("%d", &num2); int* arr2 = (int*)malloc(num2 * sizeof(int)); for(int i = 0; i < num2 ;i++) scanf("%d", &arr2[i]); // for(int i = 0; i < num2; i++) { // printf("arr2[%d] = %d\n", i, arr2[i]); // } int* arr3 = (int*)malloc((num1 + num2) * sizeof(int)); for(int i = 0; i < num1; i++) { arr3[i] = arr1[i]; // printf("arr3[%d] = %d\n", i, arr3[i]); } for(int i = 0; i < num2; i++) { arr3[num1 + i] = arr2[i]; // printf("arr3[%d] is %d\n", num1 + i , arr3[num1 + i]); } qsort(arr3, num1 + num2, sizeof(int), compare); for(int i = 0; i < num1 + num2; i++) { if(!((i >= 1) && (arr3[i] == arr3[i - 1]))) { printf("%d", arr3[i]); } } free(arr1); free(arr2); free(arr3); return 0; }