intcmp(constvoid *a, constvoid *b){ int arg1 = *static_cast<constint *>(a); int arg2 = *static_cast<constint *>(b);
if (arg1 < arg2) return-1; if (arg1 > arg2) return1; return0; }
intmain(){ int n = 0; scanf("%d", &n); int *array = newint[n]; int *sorted = newint[n]; for (int i = 0; i < n; i++) { scanf("%d", &array[i]); sorted[i] = array[i]; }
qsort(sorted, n, sizeof(int), cmp); vector<int> v; int max = -1; for (int i = 0; i < n; i++) { if (array[i] > max) { max = array[i]; }