## 10393 - The One-Handed Typist

Moderator: Board moderators

ChidoONe
New poster
Posts: 1
Joined: Wed Apr 13, 2005 8:46 pm

### 10393 WA!!!! Help!!!

I always got WA in this problem!!!! Can some one helpme!!! And say me what is the error!!!!

Program The_One_Hand_Typist;
Type
Tot = String[6];
arr = Array[1..10] of tot;
Ar = Array[1..10] of byte;
Lista = Array[1..1000] of string[50];
Lis = Array[1..1000] of byte;

Var
Mano : Ar;
Cuantos, Larga,Palabras : Integer;
h,i,j,k,l,mayor,Cont,aux : Integer;
Palabra: String;
Dedos : String;
Si : Boolean;
Sipudo : Lista;
Num : Lis;
Procedure D; Begin
Dedos:= ('qazwsxedcrfvtgb yhnujmik,ol.p;/');
For i:=1 to 10 Do
Mano:=1;
End;

Function Cual_Dedo(j:integer):byte; Begin
if (j>=1) and (j<=3) Then Begin
Cual_dedo:=1;
Exit;
End;
if (j>=4) and (j<=6) Then Begin
Cual_Dedo:=2;
Exit;
End;
if (j>=7)and(j<=9) Then Begin
Cual_dedo:=3;
Exit;
End;
if (j>=10)and(j<=15) Then Begin
Cual_dedo:=4;
Exit;
End;
if (j=16) Then Begin
Cual_dedo:=5;
Exit;
End;
if (j=17) Then Begin
Cual_dedo:=6;
Exit;
End;
if (j>=18)and(j<=23) Then Begin
Cual_dedo:=7;
Exit;
End;
if (j>=24)and(j<=26) Then Begin
Cual_dedo:=8;
Exit;
End;
if (j>=27)and(j<=29) Then Begin
Cual_dedo:=9;
Exit;
End;
if (j>=30)and(j<=32) Then Begin
Cual_dedo:=10;
Exit;
End;

End;

Procedure SePuede(Palabra:string); Begin
k:=Length(Palabra);
Si:=False;
For j:=1 to k do Begin
aux:=Pos(Palabra[j],Dedos);
If (aux=16) and (Mano[5]=0) Then Begin
aux:=17;
End
Else Begin
If (Aux=17) and (Mano[6]=0) Then
Aux:=16;
End;
l:=Cual_Dedo(aux);

if Mano[l] = 1 Then
Si:=True
Else Begin
Si:=False;
exit;
End;
End;
End;

Procedure Escribe; Begin
If Mayor <> 0 Then Begin
WriteLn(Cont);
For i:=1 to h do Begin
if Num=Mayor Then
WriteLn(SiPudo);
End;
End;
End;

Procedure Lee; Begin
Repeat;
D;
mayor:=0;
h:=0;
Cont:=1;
For i:=1 to cuantos do Begin
Mano[j]:=0;
End;
For i:=1 To Palabras Do Begin
Sepuede(Palabra);
if si then Begin
inc(h);
SiPudo[h] := Palabra;
Num[h]:=k;

if Mayor < Num[h] Then Begin
Cont:=0;
Mayor:=Num[h];
End;
If Mayor = num[h] Then Begin
inc(cont);
End;
End;
End;
Escribe;
Until (eof);
End;

Begin
Lee;
End.

chuzpa
New poster
Posts: 33
Joined: Fri Jun 18, 2004 8:39 am
Location: Mexico
Contact:

### que onda wey ?

jajajaja lo voy a checar en estos d

Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul

### 10393 WA !!!~!!! Help

Hi,
I've got lots of WA for this easy problem. I dont know where is my mistake. My code also passed all input of the past thread. Please help me.

MY CODE :- C++

Code: Select all

``````Cut After ACC....
``````
Last edited by Raj Ariyan on Tue Jun 28, 2005 7:13 am, edited 1 time in total.
Some Love Stories Live Forever ....

Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul

### WHY ?????

Hi All,
Why no reply for this easy problem ????????
Some Love Stories Live Forever ....

ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Contact:

### 10393

I tried all the i/o of this board. But still WA.

My algorith is simple:
1. First i find out the possible words with max length and make a list
2. I make a quick sort to sort the list of word with max length.
3. Cut out the duplicate words.
4. Make output.

What's the wrong in my algo.

Is there any Captial later in the input file?

Please give me some critical input & output.

mohiul alam prince
Experienced poster
Posts: 120
Joined: Sat Nov 01, 2003 6:16 am
Location: Dhaka (EWU)
hi
try this

INPUT

Code: Select all

``````5 5
6 7 8 9 10
the
stewardesses
have
funny
hair
3 19
7 8 9
waxers
wax
waxed
waxen
waxer
waxers
waxes
waxing
waxy
we
wear
wearable
wearer
wearing
wears
weave
weaver
weaves
weaving
10 1
1 2 3 4 5 6 7 8 9 10
prince
1 10
1
a
a
a
a
a
a
a
a
a
a
9 1
1 2 3 4 5 6 7 8 9
mohiulalamprince
5 1
1 3 5 7 9
thatisnotenough
8 2
4 5 6 7 8 9 1 2
sososososososososososososososo
sososososososososososososososo
9 3
1 2 3 4 6 7 8 9 10
eeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeee
aaaaaaaaaaaaaaaaaaaa
9 3
1 2 4 6 5 7 8 9 10
eeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeee
aaaaaaaaaaaaaaaaaaaa
9 3
2 3 4 6 5 7 8 9 10
eeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeee
aaaaaaaaaaaaaaaaaaaa
1 1
1
a
``````
OUTPUT

Code: Select all

``````1
stewardesses
4
waxers
wearer
weaver
weaves
0
1
a
0
0
0
2
aaaaaaaaaaaaaaaaaaaa
eeeeeeeeeeeeeeeeeeee
1
eeeeeeeeeeeeeeeeeeee
1
aaaaaaaaaaaaaaaaaaaa
1
a
``````
Thanks
MAP

sunny
Experienced poster
Posts: 124
Joined: Sun Sep 11, 2005 10:22 pm
Location: Civil-BUET
i didn't understand why 4 this inputs:

9 3
1 2 3 4 6 7 8 9 10
eeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeee
aaaaaaaaaaaaaaaaaaaa
1 1
1
a

the outputs are
2
aaaaaaaaaaaaaaaaaaaa
eeeeeeeeeeeeeeeeeeee
1
a

in both inputs finger1 is disabled so how 'a' can be printed?
may be i missed something so i got WA.
pls tell me.

Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Oh, well, three years later... Just to clear this thing up - the answer to that set is

Code: Select all

``````1
stewardesses``````
It is really bad when you spend more time trying to figure out what the input can look like than to actually solve the problem.

Anindya
New poster
Posts: 28
Joined: Sun Feb 04, 2007 4:34 am
Location: EEE,BUET,DHAKA
The output & input are given below:
Input:
9 3
1 2 3 4 6 7 8 9 10
eeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeee
aaaaaaaaaaaaaaaaaaaa
1 1
1
a
Output:
0
0
My ac code gives these outputs.
So,either prince is wrong or the judges have no such input.
Sunny,your logic seems to be ok.There is no chance of typing a.
But i don't know why you can't get ac.

hepx
New poster
Posts: 1
Joined: Fri Sep 26, 2008 9:23 pm

### Re: 10393 - The One-Handed Typist

I tried many times, and still do not know why I get WA. my output is distinct, and occurs in alphabetical order. Who knows what's wrong with my code??

import java.util.*;

public class Main
{

class inputs
{
ArrayList <String> str;
public inputs(){
this.str = new ArrayList<String>();
}
};
static String[] keys = {"qaz", "wsx", "edc","rfvtgb", " ", " ",
"yhnujm", "ik,", "ol.", "p;/"};
static boolean[] fingers;//if true than you can use finger

static int lrgSize;

public static void main(String[] args)
{

int count;
Scanner s = new Scanner(System.in);
fingers = new boolean[10];
int numWords;
int fing;
String wrd;
Main main= new Main();

ArrayList<inputs> in = new ArrayList<inputs>();

while(s.hasNext())
{

inputs inputs = main.new inputs();
count = 0;
lrgSize = 0;
fing = s.nextInt();
numWords = s.nextInt();

for(int ii = 0; ii < 10; ii++)
fingers[ii]=true;
for(int ii = 0; ii < fing; ii++)
fingers[s.nextInt() - 1]=false;

s.nextLine();

for(;numWords > 0; numWords--)
{
wrd = s.nextLine();
//System.out.println(wrd);
if(wrd.length() == lrgSize)
{
if(checkWord(wrd))
}
else if(wrd.length() > lrgSize)
{
//System.out.println(wrd + " is larger!");
if(checkWord(wrd))
{
lrgSize = wrd.length();

inputs.str.clear();
}
}
}

count++;
} // end while

for(int ii=0;ii<in.size(); ii++)
{

Collections.sort(in.get(ii).str);

if(in.get(ii).str.size() == 0)
System.out.println(in.get(ii).str.size());

else if(in.get(ii).str.size() == 1)
{
System.out.println(in.get(ii).str.size());

System.out.println(in.get(ii).str.get(0));
}
else
{

for(int j=1;j<in.get(ii).str.size();j++)
{
if(in.get(ii).str.get(j).equals(in.get(ii).str.get(j-1)))
in.get(ii).str.remove(j);

}
System.out.println(in.get(ii).str.size());
for(int k=0; k<in.get(ii).str.size();k++)
System.out.println(in.get(ii).str.get(k));
}

}
}

public static boolean checkWord(String word)
{
char temp;
boolean failed = true;
for(int ii = 0; ii < word.length() ; ii++)
{
failed = true;
temp = word.charAt(ii);
for(int check = 0; check < keys.length ; check++)
{
if(keys[check].contains(temp + ""))
{
if(fingers[check])
failed = false;
}

}
if(failed)
return false;
}

return true;

}
}

mha_bd
New poster
Posts: 1
Joined: Sat Aug 29, 2009 2:16 pm

### Re: 10393 - The One-Handed Typist

I was trying to find why a friend of mine was getting WA in this problem. And I put scanf("%s",str) instead of gets(str) in his code, and got AC.

I guess there are more than one words in one line or there are blank lines.

Hope this will help some of you to solve the problem.