Can't understand why I am getting a TLE with O(n) in Q265C.

Revision en2, by kilimanjaro2, 2016-07-18 07:34:47

Hi,

I have written a solution which runs in O(n) with n being 1e6. I am unable to understand why it gives a TLE. Any help would be much appreciated.

Link to question: http://mirror.codeforces.com/problemset/problem/265/C

Link to my code: http://hastebin.com/vususidufi.vala

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English kilimanjaro2 2016-07-18 07:34:47 0 (published)
en1 English kilimanjaro2 2016-07-18 07:33:46 334 Initial revision (saved to drafts)