Page 2 of 3

468 want some inputs and outputs

Posted: Sat Feb 04, 2006 10:31 am
by Wei-Ming Chen
Can sopmeone give me some I/O on problem 468?
Thanks very much.

Posted: Fri May 19, 2006 12:04 am
by neno_uci
Can somebody give me some I/O that does not work with my code..., I guess I am confused because I can't find my mistake, I am always getting WA...

Code: Select all

Cut after AC
Thanx in advance,

Yandry.

468

Posted: Tue Oct 31, 2006 7:12 am
by joy
This is my 1st post.... :lol:

can anyone give me some input/output for 468.....

pleaz cheak my input/output:

input:

Code: Select all

2

aabbac
pqrppqrpq

aabbac
pqrppqrpq
output:

Code: Select all

abcaabcab
----------------------<newline
abcaabcab
thanks

Posted: Tue Oct 31, 2006 8:11 am
by Jan
Your I/O set is correct. Dont open a new thread if there is one already. If there is no thread then open a new one.

Posted: Mon Dec 04, 2006 10:31 am
by razor_blue
Someone help me please,
I don't know why my code is WA...

Code: Select all

/* Removed after PE */

Posted: Mon Dec 04, 2006 12:25 pm
by Jan
Check the following sample...

Input:

Code: Select all

1

abacxbacacAAAAAAAAAA
qqqqqrrrrsssttwwwwwwwwwwwww
Output:

Code: Select all

aaaaaccccbbbxxAAAAAAAAAAAAA
Hope it helps.

Posted: Tue Dec 05, 2006 5:54 am
by razor_blue
Thank you Jan, I've fixed my code and got PE.

468.......WA

Posted: Tue Dec 05, 2006 10:35 am
by shaqira
my code is showin WA though it seams to me that it is givin the correct output, plz anyone help me with this........

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

char s1[40000][1000];
char s2[40000][1000];

struct N1
{
int f1;
char c1;

}line1[125];



struct N2
{
int f2;
char c2;

}line2[125];



bool cmp1(const N1 &a, const N1 &b)
{
if(a.f1!=b.f1)
if(a.f1>b.f1)
return true;
if(a.f1==b.f1)
if(a.c1<b.c1)
return true;
return false;
}

bool cmp2(const N2 &a, const N2 &b)
{
if(a.f2!=b.f2)
if(a.f2>b.f2)
return true;
if(a.f2==b.f2)
if(a.c2<b.c2)
return true;
return false;
}

void restore()
{
int i;
for(i=0;i<=122;i++)
{
line1.c1=i;
line1.f1=0;

line2.c2=i;
line2.f2=0;
}
}

void main()
{
int test,i,t,r,len1,len2;
scanf("%d",&test);

for(t=1;t<=test; t++)
{
scanf("%s",s1[t]);

if(strlen(s1[t])==0)
continue;

scanf("%s",s2[t]);

if(strlen(s2[t])==0)
continue;
}

for(t=1;t<=test;t++)
{
restore();
len1=strlen(s1[t]);

for(r=0;r<len1;r++)
{
if(s1[t][r]>='A' && s1[t][r]<='Z')
line1[s1[t][r]].f1++;
else if(s1[t][r]>='a' && s1[t][r]<='z')
line1[s1[t][r]].f1++;

}

len2=strlen(s2[t]);
for(r=0;r<len2;r++)
{
if(s2[t][r]>='A' && s2[t][r]<='Z')
line2[s2[t][r]].f2++;

else if(s2[t][r]>='a' && s2[t][r]<='z')
line2[ s2[t][r] ].f2++;

}
sort(line1,line1+122,cmp1);
sort(line2,line2+122,cmp2);
for(i=0;i<len2;i++)
{
for(r=0;r<=122;r++)

if(s2[t]==line2[r].c2)

printf( "%c",line1[r].c1 );

}

printf("\n");

}
}

Posted: Wed Feb 21, 2007 8:56 am
by Anindya
What's wrong with my code? Somebody please check.I have two different
frequency arrays,then substituted max of line2 by max of line1,then i made this freq 0 & so on.

Code: Select all

removed after ac.
the case my code failed:
1

qwerwererrtttttttttttttttttttttttttttttttttttttttttttttttttttt
yyyyyyyyyyyyZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZwwwwwweeeea
Help me to find some bug or give some sample i/o.My code gives correct
output for all the cases given on board about this topic.Thanks in advance.[quote][/quote]

Posted: Wed Apr 18, 2007 3:47 pm
by Mushfiqur Rahman
My Accepted code give the output for your input.

Code: Select all

rrrrrrrrrrrrtttttttttttttttttttttttttttttteeeeeewwwwq
I think the statement of this problem is very poor, because
they should clear what would be largest string size of the input. I got 3 times RE( signal 11 ) for the size of the input string. If anybody see the statistics of the problem than he will observe that the total AC runs is almost equal to total RE runs.

Posted: Wed Apr 18, 2007 4:17 pm
by sohel
This is an issue with some of the older problems - where the range of input isn't mentioned.
I usually use an array size of 10000 when range isn't explicitly stated.

However, there is a problem where the input size is 1000000 (cant remember the problem number) and still the range isn't mentioned

Re: 468 - WA!

Posted: Sat Sep 06, 2008 5:40 pm
by abid_iut
getting WA pls help!!!!

Code: Select all


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

int main()
{
	char a[10000],b[10000],c[10000],x,temp1;
	long n,i,j=0,k,l1,l2,count=0,q=0,k1=0,d[10000],temp,d1[10000],num[10000],p,min,k2=0,t;
	//freopen("468.txt","r",stdin);
	scanf("%ld",&n);
	for(k=0;k<n;k++){
		scanf("%s",a);
		scanf("%s",b);
	
	l1=strlen(a);
	l2=strlen(b);
	
	while(j<l1){
		count=0;
		x=a[j];
		if(x!='*'){c[q]=x;q++;}
		for(i=0;i<l1;i++){
			if(x==a[i] && a[i]!='*')count++;
			if(x==a[i])a[i]='*';
		}
		j++;
		if(count==0)continue;
		d[k1]=count;k1++;
	}

	for(i=0;i<k1;i++){
		for(j=i+1;j<k1;j++){
			if(d[i]<d[j]){
				temp=d[i];
				d[i]=d[j];
				d[j]=temp;

				temp1=c[i];
				c[i]=c[j];
				c[j]=temp1;
			}
		}
	}

	k1=0;
	while(j<l2){
		count=0;
		x=b[j];
		for(i=0;i<l2;i++){
			if(x==b[i] && b[i]!='*')count++;
			if(x==b[i])b[i]='*';
		}
		j++;
		if(count==0)continue;
		d1[k1]=count;k1++;
	}

	min=32000;
	for(i=0;i<k1;i++){
		if(d1[i]<min){
			min=d1[i];
			num[i]=min;
		}
	}

	p=0;
	for(i=0;i<k1;i++){
		k2=num[i];
		for(t=0;t<k2;t++)printf("%c",c[p]);
		p++;
	}
	printf("\n\n");
	}
	return 0;
}


468 : How input will be taken

Posted: Sat Nov 22, 2008 7:58 pm
by tanvir_cse
hi Jan,
u told about printing an extra line after the last case.Here is my code. Getting WA again and again.
pls send me the code of taking input and printing output....

#include<stdio.h>
#include<math.h>
#include<string.h>
#define M 9000

int a1[M], a2[M] , p1[M] , p2[M] ;

int main(void)
{
char ch, change,cat,temp;
char s1[M],s2[M],str1[M],str2[M],c[M],final[M] , hash1[M] , hash2[M];
int i,j,k,m,n,p,testcase,x,len1,len2,total,flag=0;

scanf("%d",&testcase);
for( ;testcase>0 ; testcase--)
{
if(flag)
printf("\n");

scanf("%s",s1);
//scanf("%c",&ch);
scanf("%s",s2);
//scanf("%c",&ch);

strcpy(str1,s1);
strcpy(str2,s2);
len1=strlen(str1);
len2=strlen(str2);


for(i=0; s1; i++)
{
if(s1>=97 && s1<=123)
a1[s1]+=1;
else if(s1>=65 && s1<=91)
a1[s1]+=1;
}

for(i=0; s2; i++)
{
if(s2>=97 && s2<=123)
a2[s2[i]]+=1;
else if(s2[i]>=65 && s2[i]<=91)
a2[s2[i]]+=1;
}


for(i=0;i<len1;i++)
{
for(j=i+1;j<len1;j++)
{
if(str1[i]>str1[j])
{
temp=str1[i];
str1[i]=str1[j];
str1[j]=temp;
}
}
}
// puts(str1);

for(i=0;i<len2;i++)
{
for(j=i+1;j<len2;j++)
{
if(str2[i]>str2[j])
{
temp=str2[i];
str2[i]=str2[j];
str2[j]=temp;
}
}
}
//puts(str2);

m=j=0;
while(str1[m])
{
c[j]=str1[m];
for(i=m; str1[i]==c[j]; i++,m++);

if(c[j]>=97 && c[j]<=123)
{
x=a1[c[j]];
p1[j]=x;
}
else if(c[j]>=65 && c[j]<=91)
{
x=a1[c[j]];
p1[j]=x;
}

j++;
}
total=j;
for(i=0; i<total ; i++)
{
hash1[p1[i]]=c[i];
}
for(i=0;i<total;i++)
{
for(j=i+1;j<total;j++)
{
if(p1[i]<p1[j])
{
x=p1[i];
p1[i]=p1[j];
p1[j]=x;
}
}
}




m=j=0;
while(str2[m])
{
c[j]=str2[m];
for(i=m; str2[i]==c[j]; i++,m++);

if(c[j]>=97 && c[j]<=123)
{
x=a2[c[j]];
p2[j]=x;
}
else if(c[j]>=65 && c[j]<=91)
{
x=a2[c[j]];
p2[j]=x;
}

j++;
}
total=j;
for(i=0; i<total ; i++)
{
hash2[p2[i]]=c[i];
}
for(i=0;i<total;i++)
{
for(j=i+1;j<total;j++)
{
if(p2[i]<p2[j])
{
x=p2[i];
p2[i]=p2[j];
p2[j]=x;
}
}
}



for(i=0; i<total; i++)
{
ch=hash2[p2[i]];
change=hash1[p1[i]];
//cat=ch-change;
for(j=0; s2[j]; j++)
{
if(s2[j]==ch)
final[j]=change;

}
}
final[strlen(s2)]='\0';
puts(final);
flag=1;



}

printf("\n");

}

Pls answer me as soon as possible.I have also got WA some problems of this type.

Re: 468 - WA!

Posted: Mon Mar 02, 2009 11:41 pm
by Sedefcho
To abid_iut: I don't know if you already solved this problem.

But here is a small remark: the online judge wants a single \n after
the last test case output and two \n\n after each of the previous test cases.
If not printed this way - the judge says WA, if yes - the judge says ACC.

Re: 468 - Key to Success

Posted: Sat Jan 03, 2015 9:59 pm
by sabbir_alam_ufo
Getting WA. Please help... :( :(

Code: Select all

Removed after AC
This one is getting WA too.. !!!

Code: Select all

Removed after AC