notsoawesome's blog

By notsoawesome, history, 3 years ago, In English

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: 1660D - Maximum Product Strikes Back
My 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.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by notsoawesome (previous revision, new revision, compare).

»
3 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

You get TLE because you copy vector in fuction, instead use references

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it +3 Vote: I do not like it

    I just added & in all functions in your code where is the vector parameter and got AC

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by notsoawesome (previous revision, new revision, compare).