Problem B
Boggle
I am sure, you are a big fan of the board game
“Boggle”. Don’t worry if you are not familiar with the
rules, I will explain them to you. A Boggle is a
Words in a Boggle can be constructed from adjacent letters (i.e. horizontally, vertically and diagonally), but the same dice may only be used once in a word. The words have to be listed in our dictionary to be valid.
Words with
Input
There is only one test case per file. The first line
contains the number of words
Output
For each boggle, print one line containing the maximal possible score, the longest word and number of found words. Words that are twice (or more often) in one Boggle, only count once. If there is more than one longest word, print the lexicographically smallest one. You may safely assume that there is at least one valid word in each Boggle.
Sample Input 1 | Sample Output 1 |
---|---|
5 ICPC ACM CONTEST GCPC PROGRAMM 3 ACMA APCA TOGI NEST PCMM RXAI ORCN GPCG ICPC GCPC ICPC GCPC |
8 CONTEST 4 14 PROGRAMM 4 2 GCPC 2 |