Advertisement
Mlxa

### Быстрый аллокатор

Feb 15th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. #define long ll
  5. #define all(x) begin(x), end(x)
  6.  
  7.  
  8. const int ML = 60e6;
  9. char pool[ML];
  10. char *pool_ptr = pool;
  11.  
  12. void *operator new(size_t n) {
  13.     void *res = (void *)pool_ptr;
  14.     pool_ptr += n;
  15.     return res;
  16. }
  17.  
  18. void operator delete(void *) {}
  19.  
  20. void operator delete(void *, size_t) {}
  21.  
  22.  
  23.  
  24. int main() {
  25. #ifdef LC
  26.     assert(freopen("input.txt", "r", stdin));
  27. #endif
  28.     ios::sync_with_stdio(false);
  29.     cin.tie(nullptr);
  30.    
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement