fork download
  1. // Example program
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int n, m, k, a[100], b[100];
  9.  
  10. cin >> n;
  11. for(int i = 0; i < n; i ++)
  12. cin >> a[i];
  13.  
  14. cin >> k >> m;
  15. for(int i = 0; i < m; i ++)
  16. cin >> b[i];
  17.  
  18. for(int i = 0; i < n; i ++)
  19. {
  20. if(i == k)
  21. for(int j = 0; j < m; j ++)
  22. cout << b[j] << " ";
  23. cout << a[i] << " ";
  24. }
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 3472KB
stdin
11
61 12 8 19 22 51 48 90 72 14 33
3 5
66 55 44 33 22
stdout
61 12 8 66 55 44 33 22 19 22 51 48 90 72 14 33