12583 - Memory Overflow

All about problems in Volume 125. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
sampad74
New poster
Posts: 29
Joined: Wed Jun 18, 2014 3:57 pm
Location: Bangladesh

12583 - Memory Overflow

Post by sampad74 » Mon Aug 04, 2014 6:23 pm

thanks lighted got AC.
Last edited by sampad74 on Tue Aug 05, 2014 6:25 am, edited 1 time in total.

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: UVa-12583 Memory Overflow

Post by lighted » Mon Aug 04, 2014 7:33 pm

If you have two same people in array b then your program will increase variable c several times. :)
You can change it to

Code: Select all

int ok;
for(ok = j = 0; j < m; j++)
  {
    if(b[j]== a[k])
    {
      ok=1;
    }
  }
  if (ok) c++;
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

User avatar
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 12583 - Memory Overflow

Post by uDebug » Tue Sep 23, 2014 9:40 am

On this problem when I used std::map, I ended up with TL. I had to use another data structure instead.

I've uploaded test cases I found useful during testing / debugging on uDebug.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

Zyaad Jaunnoo
Experienced poster
Posts: 122
Joined: Tue Apr 16, 2002 10:07 am

Re: 12583 - Memory Overflow

Post by Zyaad Jaunnoo » Mon Aug 31, 2015 3:05 pm

I have used stl map too but got AC in 0.000 second.

Probably a small bug in your program.. (?)

Post Reply

Return to “Volume 125 (12500-12599)”