fork(1) download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. typedef long long ll;
  6.  
  7. struct node
  8. {
  9. int l,r,val;
  10. node()
  11. {
  12. l=r=val=0;
  13. }
  14. };
  15.  
  16. vector<node> v(1);
  17.  
  18. int build(int s,int e)
  19. {
  20. int p=v.size();
  21. v.push_back(node());
  22. if(s==e)
  23. return p;
  24. int mid=(s+e)/2;
  25. int left=build(s,mid);
  26. int right=build(mid+1,e);
  27. v[p].l=left;
  28. v[p].r=right;
  29. return p;
  30. }
  31.  
  32.  
  33. int main()
  34. {
  35. const int n = 100000 ;
  36. int r=build(1,n);
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Standard output is empty