Блог пользователя msnp1381

Автор msnp1381, история, 3 года назад, По-английски

Hi I'm using macOS therefor I'm using clang instead of gcc and until now i had no problem with that but my codes in codeforces it shows memory limit exceed and i tried aging with c++14 and it did accept now I'm confused which compiler is best and what's their difference? My submissions s1 and s2

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +15 Проголосовать: не нравится

You were using Clang++17 Diagnostics, as name suggest it meant to diagnose error in runtime. Since it runs sanitizers it will consume more memory, and will be significantly slower (I think up to 10x).

You can read more about it here: https://codeforces.net/blog/entry/55902?locale=en.

You should never use it as primary compiler, even if you are locally using clang, everything will be fine with g++ as long as you are writing correct c++ code, and you are locally using same c++ standard (--std=c++14/17).

If there are disparities between two compilers its either clang/gcc bug(very unlikely), undefined behavior, or incorrect code.

You can read this wonderful blog https://codeforces.net/blog/entry/15547 that will help you catch some silly mistakes.

Also duplicate of https://codeforces.net/blog/entry/92795.

Next time please add Codeforces submissions ID (ML: 128563183, OK 128563258), because it kinda not polite to ask for help, and expect people to go look into your submissions history

»
3 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

I'm using macOS therefor I'm using clang instead of gcc

what's the problem? brew install gcc