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
New poster
Posts: 29
Joined: Wed Jun 18, 2014 3:57 pm
Location: Bangladesh

12583 - Memory Overflow

Post by sampad74 »

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

Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: UVa-12583 Memory Overflow

Post by lighted »

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])
  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

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

Re: 12583 - Memory Overflow

Post by uDebug »

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 »

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)”