anubh4v's blog

By anubh4v, history, 6 weeks ago, In English

i copy pasted example input of https://codeforces.com/contest/1391/problem/B but the output is not coming out after input of each test case, it gets mixed with input of other test cases.see image attached(/predownloaded/f4/74/f474c2cc870524573e76898948efc08138eb4198.png).

 
 
 
 
  • Vote: I like it
  • -11
  • Vote: I do not like it

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

https://ibb.co/TPxgwCJ this is the image

»
6 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

But this is the general case since both streams (input and output) are linked with the monitor.

The best one would be to use input output redirection. But you can also try using ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); in main function as it breaks and delays immediate buffer flushing.

Disclaimer: The code snippet sucks while debugging using print statements