I have been trying to solve a question but I have a bug in my code which I need to fix. I also have files with inputs and corresponding outputs for this question. However the problem is that the input files are extremely big (about 3.5MB). Therefore, I cannot run it on my laptop as I get a segfault (I am certain it is because of stack overflow when I am doing dfs as I have done many tests). And I cannot run it on any online compiler, including codeforces, because the input file is too big. Most websites only allow input as big as a few hundred KB.
So my question is — How am i supposed to run my code with this input? The online grader where I found this problem only tells me if I got a testcase right or wrong or TLE, MLE, etc. It doesn't tell me anything as to the difference between expected and my output. So what should i do?
Note: I can't really find any smaller testcases either and every testcase that I make myself seems to work.
Edit: If you guys want to try on your own computers, here is the code: https://pastebin.com/fnWh1Xbc. And here is the input: https://paste.ee/p/FJKWt Please let me know if you don't recieve a segfault. Also note that if you want to copy the input, view the file as raw (there is a button on the linked website).
Also, this is the debug code that I used to make sure that the segfault is because of stackoverflow: https://pastebin.com/w9WV7Znx
The only difference between the two pieces of code is that in the debug code, I output "second" right before I go to a new node and the first thing that I do when I am at a new node is output "first". When I do this, the last thing my program outputs is "second" which means that it is the very act of calling the function which produces a segfault, which must mean that it is stackoverflow. Note that the dfs function is called "calculate_city_info"
Have you tried running it through a file? For example ifstream fin("filename.in") in c++. I tried it on a 16 MB file and it ran succesfully.
Yes, when i tried running it on my laptop i meant that i had put the input into a file then tried running it. It gave a segfault
Then, the problem isn't related to the test and the size of it. You can definitely run a test of that size.
Ok i will edit the post with my code and my testcase. Can u try run my code on your laptop? Thanks
Hello, can you try running my code on your laptop please and see if you have a different result? Thanks. I have the code and input on my blog
add this at the beginning of the program
In the Terminal or Command Prompt,
cd
to the folder that has your program. Then, after compiling your program, type something like./programfile < inputfile > outputfile
.This method has a great advantage in that you don't need to change anything on your code.
I see i will try that in a while as i am on my phone right now
Auto comment: topic has been updated by TheOpChicken123 (previous revision, new revision, compare).