Facebook hacker cup question D1

how do i run a c++ program having array input of size>10^5,because i failed to submit the facebook hacker cup question d1 sol because my pc failed to compile/run their input files.please suggest any online compiler which takes such a large input file

1 Like

You can try using google colab

1 Like

it is too complicated for me to search the c++ compiler page,can you share the link of page where i put my source code and input file.

You can ideally declare an array of size grater than 10^5, you can do it by declaring globally.
I think you can declare an array size of order upto 10^7.(even 10^8 is also possible but not sure though)

1 Like

Go to test case generator, generate a large array of 10^5 size, and then u can just paste the input on any online compiler…

i know declaring an array of size up to 10^8 globally is possible ,but using array of size greater than 10^5 is not possible in local computer(specially for my case 8gb of ram)

why not?

i tried many online ide but i can’t paste array of size >10^4

okay now it’s working,i got my mistake and i learned something new ,thanks to all of you guys :smile:

hey can you tell what you were doing wrong… I ha faced similar issues while solving codechef problems. I cant make array size greater that 10^5 in local computer but same code works in codechef ide. Maybe your solution can help me if your problem is something similar.(I use codeblocks).

just declare the array globally

any hint for this question??

Nope .

1 Like

this is not long challenge :man_shrugging:

Can we download/see other contestants solutions after contest?

Yeah

tried that but it works only till array size of 810^5
And while i make a new array for every single test case it works till 5
10^5

what is error,i mean code is not exiting or you are getting any runtime error?

You can write this command in prompt to compile and then run the executable a.exe -
g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe

Even my laptop has ram of 8gb, it’s possible for me. So, it should be for you too!