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

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

Post by smilitude »

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>

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

Post by smilitude »

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 »

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

Post by emotional blind »

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 »

Dear emotional blind,

i did the correction, but still WA :cry:

what can i do? would u plz tell me?

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

Post by emotional blind »

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 »

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

Post by emotional blind »

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 »

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

Post by Kallol »

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 »

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 »

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 »

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)

Post by shaon_cse_cu08 »

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

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

Re: 10420 WA (PLZ HELP)

Post by sohel »

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