i dont have any idea about interactive problems as i am new to coding …can anyone tell me where i can learn to solve interactive problems ?
You can learn how to solve interactive problems here
@coder_ag You can read more about interactive problems and how to deal with them here -
thankyou … but fflush(stdout) is very time consuming and program runs out of time every time …how can i reduce time complexity in this case ?
@coder_ag yes using interactive programming does take a toll on time complexity since we have to wait for the problem judge every time we make a query. Therefore, writing code having much lesser complexities is a must.
However, we can save some of the compiling time by removing the bits/std++c.h header files and only including the necessary header files as required in the program.
Also, please ensure that you are closing the output stream before ending the program. Otherwise, you may get some unexpected results.
Hope it helps
to reduce the time you can use the ios::sync_with_stdio(false);cin.tie(0); helps to reduce the execution time also as @dipanshu_10297 said applying only necessary header will help to reduce the execution . By combining both the tricky the execution time will reduce for sure.