10420 - List of Conquests

Moderator: Board moderators

smilitude
Experienced poster
Posts: 137
Joined: Fri Jul 01, 2005 12:21 am
Little Joey wrote: I moved this thread to the correct forum. Please Mr. Smilitude, problems 104xx belong in volume 104, which is CIV in Roman numerals
Thanks Little Joey!
It seems like i myself was having invalid memory reference problem too!
fahim
#include <smile.h>

smilitude
Experienced poster
Posts: 137
Joined: Fri Jul 01, 2005 12:21 am
Roby wrote: Hmmm.. may be the array size is to small for the judge input... I've solved it with Binary Search Tree method, may be this method can help you out of this problem...
thanks a lot roby! well, actually the array size was not small for judge input but for my chaining! i got accepted in .012 seconds!
fahim
#include <smile.h>

deena sultana
New poster
Posts: 36
Joined: Mon Jun 19, 2006 5:43 pm
Contact:

10420

I got WA in 10420.
I've test some i/o but, it gives the expected result.
Anyone 2 help me? plzzzzzzzz.

Code: Select all

``````Removed after AC.
``````
Last edited by deena sultana on Sun Jun 25, 2006 9:58 pm, edited 1 time in total.

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Contact:
What do you mean by

Code: Select all

``women[k+1]=women[k]; ``
should it not be

Code: Select all

``strcpy(women[k+1],women[k])``
?

deena sultana
New poster
Posts: 36
Joined: Mon Jun 19, 2006 5:43 pm
Contact:
Dear emotional blind,

i did the correction, but still WA

what can i do? would u plz tell me?

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Contact:
you need another variable to store the frequency of key
otherwise it will gone for ever,

Code: Select all

``````for(int j=1;j<i;j++)
{
strcpy(key,women[j]);
keycount=count[j];
k=j-1;
while(k>=0 && (strcmp(women[k],key)>0))
{
women[k+1]=women[k];
count[k+1]=count[k];
k=k-1;
}
strcpy(women[k+1],key);
count[k+1]=keycount;
}
``````
Got the correction!

another thing
Last character of string should be null character '\0'

So increase all arrays from 75 to 76

Greetings

deena sultana
New poster
Posts: 36
Joined: Mon Jun 19, 2006 5:43 pm
Contact:

WA Again and again

here is my correction copy
can anyone help me?
Last edited by deena sultana on Sun Jun 25, 2006 9:59 pm, edited 1 time in total.

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Contact:
Have you read my previous post carefully?
I dont think so.

deena sultana
New poster
Posts: 36
Joined: Mon Jun 19, 2006 5:43 pm
Contact:

thnx

Thank u emotional blind, i get AC
I m very much greatful 2 u.

deena.

Kallol
Learning poster
Posts: 100
Joined: Sun Nov 13, 2005 8:56 am
Well. I was actually confused watching the name of the thread ! Why shoulf one help a problem like this. This is a nice problem . I solved this using a binary tree. If u get a new input u find it in the tree, left or right according to dictionary , and if found , add its frequency else create a new node...finally print it out ! Nice problem, easy solve. I enjoyed it
Syed Ishtiaque Ahmed Kallol
CSE,BUET

razor_blue
New poster
Posts: 27
Joined: Mon Nov 27, 2006 4:44 am
Location: Indonesia
Sedefcho wrote:
Seems like the tests the Judge has really don't contain
duplicate women names.
I follow your way, but when I send my code I got WA. I used linked-list, and strcmp() for comparing the names of countries. Or Judge changed his output?
Someone can help me, please? Any help will be appreciated.

Code: Select all

``````/* Removed after AC */
``````
Last edited by razor_blue on Fri May 11, 2007 11:50 am, edited 1 time in total.

razor_blue
New poster
Posts: 27
Joined: Mon Nov 27, 2006 4:44 am
Location: Indonesia
I got AC now....
This is weird, I change my array size for country names to 100 and got Accepted. So, Judge didn't change his output...

Mohiuddin
New poster
Posts: 6
Joined: Fri Apr 25, 2008 12:09 pm

Re: 10420 - List of Conquests

HI, i m getting runtime err for this code....can anyone help me?

Code: Select all

``````#include<stdio.h>
#include<string.h>

char str[10000][1000],ch[1000];
char temp[1000];

int main()
{
int i,j,t;

scanf("%d",&t);

for(i=0;i<t;i++)
{
j=0;

fflush(stdin);
gets(ch);

while(1)
{
if(ch[j]==' ')
{
ch[j]='\0';
break;
}
j++;
}

strcpy(str[i],ch);
}
for(i=0;i<t;i++)
{
for(j=i+1;j<t;j++)
{
if(strcmp(str[i],str[j])>0)
{

strcpy(temp,str[i]);
strcpy(str[i],str[j]);
strcpy(str[j],temp);
}
}
}

int sum=1;

for(i=0;i<t;i++)
{

if((i+1)<t&&strcmp(str[i],str[i+1])==0)
{
sum++;
}
else
{
printf("%s %d\n",str[i],sum);
sum=1;

}
}

return 0;
}``````

shaon_cse_cu08
New poster
Posts: 50
Joined: Tue May 25, 2010 9:10 am
Contact:

10420 WA (PLZ HELP)

Code: Select all

``Removed After AC....``
Last edited by shaon_cse_cu08 on Tue Jul 27, 2010 8:43 pm, edited 1 time in total.
I'll keep holding on...Until the walls come tumbling down...And freedom is all around .....

sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 10420 WA (PLZ HELP)

Have you looked at this thread - http://acm.uva.es/board/viewtopic.php?f=23&t=6361