Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

Mong_Mang's blog

By Mong_Mang, history, 3 years ago, In English

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.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
3 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

which IDE do you use

»
3 years ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

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

Also, compile with the -O2 flag.

»
3 years ago, hide # |
← Rev. 2  
Vote: I like it +3 Vote: I do not like it

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

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

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