how output should be displayed, is the output to be displayed after taking input for each query or separately after taking input for all queries? I even tried the naivest approach to see if the I/O is right i still am getting wrong answer. Please help.
Could you tell me the I/O for the question?
simply use printf("%d\n", res );
where res
is correct answer you have to print…
I mean print the answer to the query or all at once at the end?
For C/C++ (using printf
) printing one by one is ok for 105