Page 3 of 4
Posted: Fri Sep 14, 2007 5:51 pm
by mf
Compiler was updated recently. If you want to avoid compilation errors, it's best to download and use gcc.
So why it conflicts with previous declaration `char* index(const char*, int)' . Its really hard to understand.
There's a system function called
index, and in C/C++ you can't use the same identifier to name two different things (a function and a variable) in the same scope (global, in this case).
post reply
Posted: Fri Sep 14, 2007 6:03 pm
by ishtiaq ahmed
Dear mf,
Thank you very much. But its WA now. What can i do?
Here is my code
thanks.
Posted: Sat Feb 09, 2008 9:10 am
by turcse143
thanks a lot.
i use qsort then binary seach & get accepted.
for the TLE i use binary search.
Re: 10282 - Babelfish
Posted: Fri Jul 04, 2008 12:54 am
by newton
Thank You.
It was really a chilly mistake.
keep posting.
Re: 10282 - Babelfish
Posted: Fri Jul 04, 2008 5:23 am
by helloneo
newton wrote:why Compilation Error?
And also say is my algorithm correct? will the code be accepted after correction?
Try this..
Code: Select all
int comp(const void *a,const void *b) {
and..
Binary search is a correct algorithm to solve this problem..
Remove your code after AC
Re: 10282 - Babelfish
Posted: Wed Oct 22, 2008 12:46 pm
by jahin
im getting RTE .
but why??
Re: 10282 - Babelfish
Posted: Wed Oct 22, 2008 7:53 pm
by jahin
got ac
Re: 10282 - Babelfish
Posted: Thu Oct 23, 2008 8:40 pm
by newton
jahin wrote:
got ac
if it is
remove ur AC code please
Re: 10282 - Babelfish
Posted: Wed Sep 02, 2009 6:52 pm
by tajbir2000
I am getting WA.....Where is the problem?
Code: Select all
#include<iostream>
#include<map>
#include<string>
using namespace std;
map<string,int>M;
typedef struct{
char final[205];
}data;
data A[100005];
int main(){
int i,cnt,j,k;
char str[205],tempa[200],tempb[200];
//freopen("i.txt","r",stdin);
cnt=0;
while(gets(str)){
if(!strcmp(str,""))
break;
i=0;
while(1){
if(str[i]==' ')
break;
i++;
}
for(j=0;j<i;j++)
tempa[j]=str[j];
tempa[j]='\0';
strcpy(A[cnt].final,tempa);
for(k=0,j=i+1;str[j];j++,k++)
tempb[k]=str[j];
tempb[k]='\0';
M[tempb]=cnt;
cnt++;
memset(tempa,NULL,sizeof(tempa));
memset(tempb,NULL,sizeof(tempb));
memset(str,NULL,sizeof(str));
}
while(gets(str)){
if(M[str]){
printf("%s\n",A[M[str]].final);
}
else
printf("eh\n");
}
return 0;
}
Re: 10282 - Babelfish
Posted: Fri Nov 26, 2010 10:36 am
by zobayer
so? everyone forgot about the TRIE

????
Re: 10282 - Babelfish
Posted: Wed Jun 27, 2012 9:25 pm
by sith
Hello
I've got WA, Why? Is it because of my simple implementation of map?
Re: 10282 - Babelfish
Posted: Wed Jun 27, 2012 11:59 pm
by brianfry713
Use a map, not a hashCode.
Re: 10282 - Babelfish
Posted: Thu Jun 28, 2012 10:10 am
by sith
Thank you. It works
Re: 10282 - Babelfish
Posted: Sun Feb 10, 2013 9:23 pm
by kier.guevara
Why did I get a TLE? I used the sort function and do a binary search. Is the sort and binary search not efficient enough for this problem?
Re: 10282 - Babelfish
Posted: Mon Feb 11, 2013 12:49 am
by brianfry713
Try using a map.