fork(1) download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. // Either globally or in a single class:
  5. static char buf[450 << 20];
  6. void* operator new(size_t s) {
  7. static size_t i = sizeof buf;
  8. assert(s < i);
  9. return (void*)&buf[i -= s];
  10. }
  11. void operator delete(void*) {}
  12.  
  13. vector<int>arr;
  14.  
  15. signed main(){
  16. arr.resize(1,10);
  17. int*pt=&arr[0];
  18. cout<<*pt<<endl;
  19. arr.resize(100);
  20. cout<<*pt<<endl;
  21. }
Success #stdin #stdout 0.01s 5268KB
stdin
Standard input is empty
stdout
10
10