Advertisement
joric

cf_allocator.cpp

Aug 3rd, 2024
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. # codeforces allocator
  2.  
  3. const int max_memory = 13e7;
  4.  
  5. int pos_memory = 0;
  6. char memory[max_memory];
  7.  
  8. void* operator new(size_t n) {
  9.     char *res = memory + pos_memory;
  10.     pos_memory += n;
  11.     assert(pos_memory <= max_memory);
  12.     return (void*) res;
  13. }
  14.  
  15. void operator delete(void *){}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement