Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

Why is my 2*n Implementation getting a TLE? (D-Maximum Product Strikes Back, Div-3 #780)
Difference between en1 and en2, changed 555 character(s)
Sorry, I am getting back into competitive programming after a bit of gap, so sorry if there might be some silly implementation error  ↵
The link to the problem is here: [problem:1660D]  ↵
My Submission [submission:153302296]
  ↵
  ↵
(Here a bit of explanation of my logic, ofc what needs to be done is very obvious, we need to look at sub-arrays between two zeros, its only the implementation that depends on your method, I first made an array containing indexes of zeros and then I pass those indexes to a function that calculates the left, right for that particular subarray and updates global ans, global left and global right. and as multiplication will overflow, I used mul function (which basically adds instead of multiply and takes care of sign accordingly)  ↵
  ↵
Thanks.


History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English notsoawesome 2022-04-10 18:56:17 8
en2 English notsoawesome 2022-04-10 18:34:15 555
en1 English notsoawesome 2022-04-10 18:27:59 316 Initial revision (published)