What's going on??
Hello codeforces! Recently, i've noticed that codeforces custom test with g++ 17 uses more than 500bytes per empty std::queue, while sizeof shows only 40bytes. This problem is also with std::deque. What's going on? Compiled with GNU G++17 7.3.0










Auto comment: topic has been updated by lis05 (previous revision, new revision, compare).
Nevermind, I misunderstood that you were comparing the computed value with the memory reported under the =====.
sizeof(arr)/1000shows size in kb, look at the second imagesizeof(arr)/NMAXshows size in bytes for single queuestd::queueusesstd::dequeunder the hood by default. And in GCC's libstdc++ standard library the latter allocates elements dynamically in chunks of ~512 bytes by default, seeM_initialize_maphere, plus one chunk extra. It's that extra chunk which makesstd::dequeweigh slightly more than 500 bytes.Thanks!