i previously tried to submit the question- Little Elephant and Subarrays-of february challenge2014 by taking Q as short int, but it showed wrong answer.I tried to find the error for 2 hours, later I submitted the same answer by just changing Q from short int, to int & it got accepted. may i know why this happened ?(Range of Q mentioned int the question was 1<=Q<=10)
Hi,
Either you had another bug in your code when you used short int and then fixed it afterwards when you changed for int, or, in case you are using fast I/O you might have used the wrong format specifier, like, using “%d” for denoting a short int, which might cause undefined behavior as far as I think.
Besides, using short int for the value of Q, with the correct format specifier, “%hd”, got me AC on my previous code, so, Im sure your bug must be somewhere else…
Best,
Bruno
1 Like