10420 - List of Conquests

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

Moderator: Board moderators

User avatar
smilitude
Experienced poster
Posts: 137
Joined: Fri Jul 01, 2005 12:21 am

Post by smilitude » Wed Apr 12, 2006 12:13 pm

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
I moved your other thread too.
Thanks Little Joey!
It seems like i myself was having invalid memory reference problem too! :D
fahim
#include <smile.h>

User avatar
smilitude
Experienced poster
Posts: 137
Joined: Fri Jul 01, 2005 12:21 am

Post by smilitude » Wed Apr 12, 2006 12:25 pm

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! :wink:
fahim
#include <smile.h>

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

10420

Post by deena sultana » Sun Jun 25, 2006 7:28 pm

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.

User avatar
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind » Sun Jun 25, 2006 7:51 pm

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
Location: Bangladesh
Contact:

Post by deena sultana » Sun Jun 25, 2006 8:06 pm

Dear emotional blind,

i did the correction, but still WA :cry:

what can i do? would u plz tell me?

User avatar
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind » Sun Jun 25, 2006 8:18 pm

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
Location: Bangladesh
Contact:

WA Again and again

Post by deena sultana » Sun Jun 25, 2006 8:33 pm

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.

User avatar
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind » Sun Jun 25, 2006 8:37 pm

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
Location: Bangladesh
Contact:

thnx

Post by deena sultana » Sun Jun 25, 2006 9:56 pm

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

deena.

User avatar
Kallol
Learning poster
Posts: 100
Joined: Sun Nov 13, 2005 8:56 am

Post by Kallol » Wed Jun 28, 2006 1:20 pm

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 :D
Syed Ishtiaque Ahmed Kallol
CSE,BUET
Bangladesh

razor_blue
New poster
Posts: 27
Joined: Mon Nov 27, 2006 4:44 am
Location: Indonesia

Post by razor_blue » Fri May 11, 2007 11:39 am

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. :cry:

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

Post by razor_blue » Fri May 11, 2007 11:49 am

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... :lol:

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

Re: 10420 - List of Conquests

Post by Mohiuddin » Sat Apr 04, 2009 5:19 pm

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;
}

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

10420 WA (PLZ HELP)

Post by shaon_cse_cu08 » Tue Jul 27, 2010 9:28 am

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 ..... :x

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

Re: 10420 WA (PLZ HELP)

Post by sohel » Tue Jul 27, 2010 12:30 pm

Have you looked at this thread - http://acm.uva.es/board/viewtopic.php?f=23&t=6361
Don't create a new thread for a problem that already exists!

Post Reply

Return to “Volume 104 (10400-10499)”