Page 4 of 4

Re: 10282 - Babelfish

Posted: Mon Feb 11, 2013 2:32 am
by kier.guevara
Thanks brianfy for the tip! got AC!

10282 - Babelfish

Posted: Sun Jun 02, 2013 1:13 pm
by eop
i have gotten AC with my STL::map version

but this one, my Hash version submission got a CE

i see no problem compiling on my own computer with Dev-C++ 4.9.9.2

can somebody please help me!!!!!

my code:
//by eop
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define Hash 3
char index[100005][15];
int dic[60000],top=1;
char s[50];
int main ()
{
while ( gets(s)!=NULL && strlen(s) ) {
char a[15],b[15]; sscanf(s,"%s %s",a,b);
strcpy(index[top],a);
int tmp=0,n=strlen(b);
for ( int i=0; i<n; i++ ) tmp=tmp*3+b-'a';
dic[tmp]=top++;
}
while ( gets(s)!=NULL ) {
int tmp=0,n=strlen(s);
for ( int i=0; i<n; i++ ) tmp=tmp*3+s-'a';
if ( !dic[tmp] ) puts("eh");
else puts(index[dic[tmp]]);
}
return 0;
}
//---------------------------------------

Re: 10282 - Babelfish

Posted: Tue Jun 11, 2013 12:28 am
by brianfry713
Click My Submissions to see the reason for your CE.

Re: 10282 - Babelfish

Posted: Sat Jan 04, 2014 8:28 am
by uDebug
Here's some input / output that I found useful during testing / debugging.

Input:

Code: Select all

dog ogday
cat atcay
pig igpay
froot ootfray
loops oopslay
kitten booskay
paper koopsmay

atcay
ittenkay
oopslay
booskay
kitten
booskays
koopsmay
AC Output:

Code: Select all

cat
eh
loops
kitten
eh
eh
paper