4

Need Help regarding TLE - Codeforces

 2 years ago
source link: http://codeforces.com/blog/entry/97954
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Need Help regarding TLE

Why i m getting TLE for this problem ??? and my solution is this. here preprocessing take O(n) and per query take constant time please help.

15 minutes ago, # |

Use these two lines for fast IO at the start of the main function (can look at the below code).

ios_base::sync_with_stdio(false);
cin.tie(0);    cout.tie(0);  cerr.tie(0);

I submitted the same code as yours for finding the errors; your code was correct. Your code with fast IO You can read this for Theory for fast IO

I also faced some similar types of issues. I used endl instead of "\n" and got TLE on 9 TC too.

TLE with endl

AC with "\n"

Happy Coding :)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK