×

# Help in Codeforces Power Array TLE!

 0 I have used mo's algorithm to solve this question... But still I'm getting TLE!!! And I can't understand why I'm getting TLE for different test case numbers by doing minor changes. (The overall time complexity should remain same even after doing these changes!) This code gives TLE on test case 41, This one gives TLE in test case 43 (Removed sorting step from previous code and instead stored results in a different array) asked 16 Feb '18, 17:38 71●6 accept rate: 0% 1 You may find this previously asked question helpful: link (16 Feb '18, 18:11) meooow ♦6★ Thanks the link really helped! But can you tell me @meooow why such small modifications like converting ll to int and using inline functions have so much effect on running time! (17 Feb '18, 10:21) 2 Yup, thanks to @meooow for cool info. Btw, I know the reason for inline function. By using inline function, the compiler inserts the body of the function wherever you call the function and thus no stack push/pop operations for function calls and stuff. This saves time. Well the trick used in sorting is quite fascinating though :) (18 Feb '18, 01:28) 1 Yes @dishant_18 is right about inline functions. Only one correction, the inline keyword is only a suggestion to the compiler, and the compiler may decide not to replace the calls with the function body. (18 Feb '18, 14:13) meooow ♦6★
 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:

×2,718
×717
×672
×6

question asked: 16 Feb '18, 17:38

question was seen: 242 times

last updated: 18 Feb '18, 14:22