Блог пользователя Bibbidi_Babbidi_Boo

Автор Bibbidi_Babbidi_Boo, история, 4 года назад, По-английски

Hi,

I'm new to the CP scene, and I'm trying to get the code working. I'm not able to find the reason for the memory problem. Can someone help me out. Submission 101142835

Thanks

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +15 Проголосовать: не нравится

I believe your issue is because of the following code:

while (temp > 1) {
	while (temp%div == 0)
		temp = temp/div;
	a.push_back(div);
	div++;
}

Since temp can be very big, and also not have any divisors, you could end up pushing almost 109 numbers into a. This would happen if temp is a large prime, like 999999937.

Also, just in case you don't know, Div1A and Div2A are of different difficulties. Div1A is equivalent to Div2C, so if you're just starting out, try some Div2A problems first.

»
4 года назад, # |
Rev. 2   Проголосовать: нравится -25 Проголосовать: не нравится

.