this is giving me a runtime error
DIVISIBLE SUBARRAYS
Check now ->
you have decreased the size of pre and a array but I want the size to remain same 10^6+5
But it will then generate TLE
but I have used long long for storing elements more than 10^5
still it’s giving me wrong answer
See this, have declared array outside of main function to reduce some time. Also see size of array a is of 10^5 which indicates value of n, and mapping array size has been 10^6. Initialisation of arrays also takes time
Check again.
so initialisation of array reduces time??
Suppose you have 10 test cases and each time you declare an array of size 10^5 , this results in t tiime.
You can reduce this t time if you initialise your array of size 10^5 outside of main function. So that it’s initialised only one time and not 9 more times. So to reduce this time i have initialised your pre array outside main function.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.