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

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

In Facebook Hacker Cup 2022 Round 2, I coded a right O(n) solution (C++) for Problem A, but I downloaded the input test case and ran the code. but it took me around 8 minutes to get the output. As a result, I couldn't submit the output. However, after the contest, I submitted the output and got accepted. Can anyone please tell me how can I compile fast or overcome this problem or any suggestions regarding this?

Note: I use Codeblocks IDE. Sometimes I use VS Code.

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

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

which IDE do you use

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

What was the complexity of your solution? Are you sure it was meant to pass?

Also, compile with the -O2 flag.

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

You might want to check how fast you're reading the input. If a correct C++ solution took around 8 minutes, IO would be the culprit. If that's the case, you should use Fast IO.

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

how can I compile fast

If it's really a compilation what took so long (I doubt so) then just compile before downloading the input

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

my laptop cannot handle running large input and output. Is there any online judge which can compile very fast.