How to speed up input in scanf in C ?

Revision en2, by ghoshsai5000, 2017-03-30 02:10:49

I have been solving this problem and here's my code and my test cases — http://mirror.codeforces.com/contest/717/submission/25885501

I got a Time Limit Exceeded. And I'm not sure if it's because of the logic (because the processing is O(n^2) ) or if it's because the input is taking a lot of time. Can someone suggest ways on speedening up the code so that I don't get a TLE ?

Thanks

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English ghoshsai5000 2017-03-30 02:10:49 2 Tiny change: 'ing is O(n) ) or if ' -> 'ing is O(n^2) ) or if '
en1 English ghoshsai5000 2017-03-29 18:57:41 423 Initial revision (published)