×

# MINVOTE(March Long Challenge)

 0 Can anyone explain me why this approach is giving TLE in last 2 test cases. Here I am maintaining prefix sum and doing iteration for ji . Link- https://www.codechef.com/viewsolution/17789093 asked 13 Mar, 10:04 3★ankush23 31●4 accept rate: 0%

 0 You used two nested loops ,so time complexity of your solution is $O(n^2)$, which will for sure cannot pass those test cases as sum of $N$ in all test cases is $\leq{10^6}$ Refer to this editorial for alternative approach and my explanation of time comlexity. MINVOTE EDITORIAL Please upvote my answer if you got the point as I need 3 karma points to contribute to codechef discuss. answered 13 Mar, 13:07 815●1●12 accept rate: 13%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×335
×268
×44
×8