msnp1381's blog

By msnp1381, history, 3 years ago, In English

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

  • Vote: I like it
  • -3
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
Rev. 2   Vote: I like it +15 Vote: I do not like it

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 years ago, # |
  Vote: I like it +1 Vote: I do not like it

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

what's the problem? brew install gcc