hossainzarif's blog

By hossainzarif, history, 5 years ago, In English

https://vjudge.net/problem/LightOJ-1289
This problem states to find lcm from 1 to n. I firstly did sieve from 1 to 100000000. Then, calculated the multiple results of all prime powers which does not exceed x (2 <= x <= 100000000). And then processed the query.
https://ideone.com/1zDXDc
I tried out every possible cases I found and don't see any RTE in my compiler. Even for this case in the Ideone.

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

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

It says Runtime error on Ideone too.

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    But compiles correctly in codeblocks and gives the desired output. Then how it gets RTE in ideone and in verdict?

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Though I didn't debug your code, and yeah it's really hard to go through every line of some others code, maybe I can give you an advice. this problem has memory limit of 64mb which your code exceeds(of course this is not the reason of your runtime error!). but maybe you should try for bitwise sieve for this problem. it saves space for problem like this with tight memory limit. And yeah, another quick suggestion, you may try commenting out some parts of your code and see if it still shows the messege runtime error. if you find some part that commenting out this part is solving out runtime error, you will be sure that your fault lies in this part. it will narrow down your code to look for bug. And yeah, Maybe there is some issues with the length of your vector. in a vector/array, I always use highest 10^7 elements. Maybe 10^8 range is being too much for this. You should check it and make sure the range of a vector.