You are not logged in. Please login at www.codechef.com to post your questions!

×

# 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%

One Answer:
 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 457●7 accept rate: 23%
 toggle preview community wiki:
Preview

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• link:[text](http://url.com/ "title")
• 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:

×273
×215
×44
×8

question asked: 13 Mar, 10:04

question was seen: 258 times

last updated: 14 Mar, 16:49