For problems such as DFMTRX
, where for n= 1000, it generates huge matrix.
How can we test it offline, where for such inputs, it crashes the console output.
Is there a way around to handle such cases?
For problems such as DFMTRX
, where for n= 1000, it generates huge matrix.
How can we test it offline, where for such inputs, it crashes the console output.
Is there a way around to handle such cases?
Did you consider redirecting the output produced by your executable to a file like this?
./executable.out < input.txt > output.txt
yes i am using sublime text and with freopen thing, i am redirecting output to output.txt,
it works for n=400 , but for larger values, .exe itself crashes.
I face similar issues.
My processor is not powerful, hence, I have to restart my laptop. 
So, it’s not the console output that crashes, it’s your program.
In that case, you made a little booboo @line 49 by assuming that arrays with non-const size work in C++, which is not entirely correct. In fact, the maximum even integer for which your program works, on my machine is 508.
So, all I did was this @line 49 and submitted the code
vector<vector<ll> > mat(n + 1, vector<ll>(n + 1)); // ll mat[n+1][n+1];
and got an AC. Now it works locally for inputs as large as 2000 too. Hope this helps. ![]()
Thank you very much!
I also find out that , if i put that
outside function, in global scope, it will run perfectly for larger inputs without crashes.
Seems, maximum size of declaration in non-global scope is limited.