fork download
  1. #include<iostream>
  2. #include<conio.h>
  3. #include<vector>
  4. #include<queue>
  5. #include<bits/stdc++.h>
  6. #include<conio.h>
  7. #include<cmath>
  8. #include<string>
  9. #include<stdio.h>
  10. #include<algorithm>
  11. #define ff first
  12. #define ss second
  13. #define pb(a) push_back(a)
  14. #define mk(a,b) make_pair(a,b)
  15. using namespace std;
  16. typedef long long ll;
  17. typedef float fl;
  18. typedef pair<int, int> pii;
  19. typedef vector <int> vint;
  20. typedef vector < pii > pvint;
  21. typedef vector <bool> bvint;
  22. typedef vector <vint> vvint;
  23. const int inf=2e9;
  24. int a[1000];
  25. vvint t;
  26. void build_tree(int v, int tl, int tr) {
  27. if (tl == tr) {
  28. t[v].push_back(a[tl]);
  29. } else {
  30. int tm = (tl + tr)/2;
  31. build_tree(v*2,tl,tm);
  32. build_tree(v*2+1,tm+1,tr);
  33. t[v].resize(tr - tl + 1);
  34. merge(t[v * 2].begin(), t[v*2].end(),t[v * 2 + 1].begin(),t[v * 2 + 1].end(), t[v].begin());
  35. }
  36. }
  37. int main()
  38. {
  39. int n;cin>>n;
  40. for(int i=1;i<=n;i++) cin>>a[i];t.resize(2*n+1);
  41. build_tree(1, 1, 5);//t.pb(0);
  42. for(int i=1;i<2*n;i++){
  43. for(int j=0;j<t[i].size(); j++) cout<<t[i][j]<< " "; cout<<endl;
  44. }
  45. cout<<endl;
  46. return 0;
  47. }
  48.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:18: fatal error: conio.h: No such file or directory
compilation terminated.
stdout
Standard output is empty