Interactive questions

what is meaning of getting wrong answer verdict in interactive questions like https://www.codechef.com/JUNE20A/problems/GUESSG/
Does this mean that I am not flushing the output properly or is it that I am making more queries;

2 Likes

also suggest ways of flusing output

1 Like

and anyways of testing interctive questions before submitting?

1 Like
2 Likes

:+1:

should we write this(cout<<flush;) after every cout<<" …"<<endl; statement ?

2 Likes

I was also facing same problem yesterday. Finally I found that endl automatically flushes the output. So whenever you are printing a line in interactive problems, just add endl at the end of line. So no need to use cout<<flush.

1 Like

Use scanf to scan string, and printf to print your querey, and after every query print use fflush(stdout); (It worked for me)

2 Likes

Well, according to my knowledge, endl automatically adds a newline and flushes the output buffer. So this will suffice.

1 Like