1003.cpp 366 B

123456789101112131415161718192021
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. using namespace std;
  5. int arr[30000];
  6. int main() {
  7. int n;
  8. cin >> n;
  9. for (int i = 0; i < n; ++i) scanf("%d", arr+i);
  10. sort(arr, arr+n);
  11. int k;
  12. cin >> k;
  13. for (int i = 0; i < k; ++i) {
  14. int tmp = 0;
  15. scanf("%d", &tmp);
  16. printf("%d\n", arr[tmp-1]);
  17. }
  18. return 0;
  19. }