fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. int k; cin >> k;
  6. while(k--){
  7. int n; cin >> n;
  8. vector<int> a(n);
  9. vector<int> b;
  10. for(int i = 0; i < n; i++){
  11. cin >> a[i];
  12. }
  13. sort(a.begin(), a.end());
  14. for(int i = 0; i < n; i++){
  15. if(a[i + 1] - a[i] != 1){
  16. a.insert(a.begin() + i + 1, a[i] + 1);
  17. b.push_back(a[i] + 1);
  18. }
  19. }
  20. for(auto x : b){
  21. cout << x << " ";
  22. }
  23. cout << endl;
  24. }
  25. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty