fork(2) download
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cmath>
  4. // Include headers as needed
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. // Write your code here
  11. int T,count,n,*a;
  12. // int imin;
  13. cin >> T;
  14. int value,hole;
  15.  
  16. while(T--)
  17. {
  18. cin >> n;
  19. count=0;
  20. a=new int[n];
  21. //reading the input array
  22. for(int i=0;i<n;i++)
  23. {
  24. cin >> a[i];
  25. }
  26.  
  27. // considering the 0th element to be already sorted and
  28. // remaining list unsorted
  29. // for(int i=1;i<n;i++)
  30. // {
  31. // value=a[i];
  32. // hole=i;
  33. // // shifting
  34. // while(hole>0&&a[hole-1]>value)
  35. // {
  36. // //
  37. // a[hole]=a[hole-1];
  38. // hole=hole-1;
  39. // count++;
  40. // }
  41. // a[hole]=value;
  42. // }
  43. // cout << count<<endl;
  44. }
  45. // Return 0 to indicate normal termination
  46. return 0;
  47. }
  48.  
Runtime error #stdin #stdout #stderr 3.39s 529920KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc