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

×

TLE in SEGPROD (NOVEMBOR LONG CHALLENGE)

Can someone please spot out the time consuming factors in my code for the question https://www.codechef.com/NOV17/problems/SEGPROD/ from Novembor Long Challenge and how to get AC in all 3 subtasks(where to optimize! :(). I tried a lot to optimize but this is the bare minimum thing that has to be calculated in order to reach to the final answer.

Here's the link to my submission : https://www.codechef.com/viewsolution/16258320

I am getting TLE in one test file each of subtask 1 and 2.. and TLE in the first 2 test files of subtask 3.

Thanks, in advance. :)

asked 14 Nov '17, 00:36

jaideeppyne's gravatar image

5★jaideeppyne
2616
accept rate: 3%


I have just posted editorial for this problem here. Exactly explaining how to optimize as constraints were too tight.

link

answered 14 Nov '17, 00:40

taran_1407's gravatar image

5★taran_1407
4.0k31105
accept rate: 22%

edited 14 Nov '17, 00:40

I have read your post, bro. :)

But can you just take a quick glance at my code and probably say what can be some possible TLE causing factors and how can I rectify to get an AC. :)

That would of greattt help !

(14 Nov '17, 00:43) jaideeppyne5★

I'm not much in c++, so i can't say much. But i guess vectors are making your solution slow. Prefer using arrays when constraints are one of the tightest i have ever seen

(14 Nov '17, 00:44) taran_14075★

Use arrays in place of vectors. Maximum number of prime factors of P will be 10. Enjoy coding!

(14 Nov '17, 00:55) taran_14075★
toggle preview
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:

×729
×427
×365
×67
×14

question asked: 14 Nov '17, 00:36

question was seen: 310 times

last updated: 14 Nov '17, 00:55