10815 - Andy's First Dictionary

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

Moderator: Board moderators

Post Reply
Sedefcho
A great helper
Posts: 374
Joined: Sun Jan 16, 2005 10:18 pm
Location: Bulgaria

Internal compiler error

Post by Sedefcho »

I am trying to submit my Java program.

I have solved many problems using Java ( not that many but
enough to be aware of how should I form my Java file ).

Well, now I have a problem I have never seen before.

I get a Compile Error and I receive an email
which says only this:

Here are the compiler error messages:
gcj: Internal compiler error: program jc1 got fatal signal 11


Well, I have a main class, it is not public and
I have a main function in it.

Anybody has an idea what the reason could be ?!
Sedefcho
A great helper
Posts: 374
Joined: Sun Jan 16, 2005 10:18 pm
Location: Bulgaria

Post by Sedefcho »

My Java program is trying to solve problem 10815 by the way.
w k
Learning poster
Posts: 74
Joined: Wed Apr 14, 2004 11:14 pm

10815 - Andy's First Dictionary

Post by w k »

Hi,

What is correct answer to the input:

"Andy's" ?

Is it:

andy
s

or

andy's

or andys ?


Wojciech
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

Problem statement makes it pretty clear: "a word is defined as a consecutive sequence of alphabets". In your case, "Andy" and "s" are two separate words and the right output is the first one.
Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer »

Hi,

I prepared the judge input, and I can tell you that there are NO apostrophes in the file. :wink:
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
birdegg
New poster
Posts: 6
Joined: Wed Jan 05, 2005 10:42 pm

10815 -Andy's First Dictionary-Runtime Error

Post by birdegg »

Hi~
I try this problem several time, but always got "runtime error" less
than 0.5sec. I use array of size 5000*5000 to store.
I think it's quite sufficient. Can somebody give me a hint.
thanks.~ :wink:

Code: Select all

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

#define MAXLEN 5000
#define MAXWORD 5000

void removeNonAlpha(char t[],int len);
int compare(const void *a, const void *b);

char store[MAXWORD][MAXLEN];
char t[MAXLEN];
long globali=0;

int main(){
        code removed.
}
Last edited by birdegg on Tue Mar 01, 2005 4:01 am, edited 1 time in total.
misof
A great helper
Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

Post by misof »

In the process when splitting the current "token" into alphabetic parts your current number of words may exceed 5000.
birdegg
New poster
Posts: 6
Joined: Wed Jan 05, 2005 10:42 pm

Post by birdegg »

misof wrote:In the process when splitting the current "token" into alphabetic parts your current number of words may exceed 5000.
thank you,misof
finally I got AC.
I use getchar() rather than scanf()
but still need a large array to store and then sort.
I am wondering how those guys solve this problem with only 64KB of memeories.
Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry »

The memory usage for very short programs are known to be inaccurate - ignore them.
Sakib
New poster
Posts: 24
Joined: Fri Jan 28, 2005 5:27 pm
Location: Bangladesh

10815 - Andy's First Dictionary

Post by Sakib »

Can anyone tell me what will be the array size that will get AC.
:cry:
I am getting either MLE or RTE.
please help!!!!!!!!!!!!
/* Sorry For Nothing */
mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

Depends on what you're using the array for... I needed just a bit above 5000 entries for words, 256 bytes each.

There's much more than 5000 words in the input, but less than 5000 unique ones.
sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

Post by sumankar »

Hi,

Use a linked list, a binary tree to be precise.That'll give a good performance as well.

Regards,
Suman.
taborda
New poster
Posts: 6
Joined: Wed Mar 16, 2005 1:57 am

10815 - Andy's dictionary

Post by taborda »

i keep receiving wrong answer...any critical input i can't remembr??...
sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

Post by sumankar »

Few things:

1) please use an already existing thread for a given problem, if there's one that is.
2) check your method that extracts words, some bug there possibly
3) the array or whatever data structure you are using to store the words,
is probably small
4) maybe some problem with lexicographic ordering of words,
...
I can go on, throwing stones, until and unless you come up with your algo.

Regards,
Suman.
lord_burgos
New poster
Posts: 43
Joined: Mon Oct 13, 2003 4:54 pm
Location: Mexico
Contact:

Post by lord_burgos »

My idea

string a[MAX+1];
string b[MAX*MAX];
for x = 1 to n begin read(a[x]);
nc = 0;
for x = 1 to n begin
for y = 0 to n-1 begin if(!leter(a[x][y])) a[x][y] = ' ';
buf = strtok(a[x], " \n");
while(buf != NULL){
b[nc++] = buf;
buf = strtok(NULL , " \n");
}
endfor

sort(b[x]);
print(b[0])
for x = 1 to nc-1 begin if(b[x] != b[x-1]) print(b[x]);
Post Reply

Return to “Volume 108 (10800-10899)”