## 11058 - Encoding

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

Moderator: Board moderators

Ashkankhan
New poster
Posts: 12
Joined: Wed Oct 13, 2004 10:14 am
Location: Teh
Contact:

### 11058 - Encoding

can any body give i/o for this problem.I got WA

arsalan_mousavian
Experienced poster
Posts: 111
Joined: Mon Jan 09, 2006 6:19 pm
Location: Tehran, Iran
Contact:

### Re: 11058 : Encoding

Ashkankhan wrote:can any body give i/o for this problem.I got WA
hi dear ashkan ,
it's good to see you , i think this problem is so trivial , maybe you did a little mistake , and i am not so good in generating IO ( i wish i could ), but you can PM me your code , and i'll check it 4 u
yours
Arsalan
In being unlucky I have the record.

Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

### Re: 11058 : Encoding

Ashkankhan wrote:can any body give i/o for this problem.I got WA
I don't think this problem has any special cases... If you wish, just post your code here. Facing it some huge random inputs with outputs generated by AC could help to find the mistake.

Ashkankhan
New poster
Posts: 12
Joined: Wed Oct 13, 2004 10:14 am
Location: Teh
Contact:

### Thanx

thanx Dear Arsalan.I got AC.
But is there faster algorithm for this problem?

Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

### Re: Thanx

Ashkankhan wrote:thanx Dear Arsalan.I got AC.
But is there faster algorithm for this problem?
In what sense a faster algorithm do you want? There is no asymptotically faster algorithm, as this one does not do much more than just reading the input. However, you can prune your input routines to read the input quicker, but this does not make your algorithm asymptotically faster.

arsalan_mousavian
Experienced poster
Posts: 111
Joined: Mon Jan 09, 2006 6:19 pm
Location: Tehran, Iran
Contact:

### Re: Thanx

Ashkankhan wrote:thanx Dear Arsalan.I got AC.
But is there faster algorithm for this problem?
i don't think so , because this problem is so easy , it's a kind of simulation problem , and no need to think in order to solve it , but if you change your "cr" first dimension from 1005 to 100 ,and when you update the array up to strlen ( a ) instead of 1005, it would be faster

yours
Arsalan
In being unlucky I have the record.

_.B._
Experienced poster
Posts: 160
Joined: Sat Feb 07, 2004 7:50 pm
Location: Venezuela
Contact:

### I/O

Greetings!
Anyone willing to post critical I/O?
I believe I'm missing something of the description of the problem
Or, at least, the ACed output for this input:

Code: Select all

``````ufrn
t
o
w
k
q
z
f
n
y
i
c
m
s
j
n
r
g
l
d
s
u
s
g
y
e
u
14
0 q t
0 j f
1 v d
1 r o
1 f d
1 r o
1 f a
2 e p
2 r w
2 v e
2 f x
3 y p
3 t m
3 u k
``````
_.

Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
This is my output for your input:

Code: Select all

``````Case #1: The encoding string is uawj.

``````
This is the only one I got in one try, I was surprised by it. I think the only thing that was close to being tricky was that you have to update your rule table every time there is a change (for all remaining steps, not just that one).

_.B._
Experienced poster
Posts: 160
Joined: Sat Feb 07, 2004 7:50 pm
Location: Venezuela
Contact:

### Fast!

That's some pretty fast answer Darko!
Thanks a lot!
My output is wrong :S
Going to check why.
_.

Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Heh, I didn't see the time, I already edited it :)

ytsejam
New poster
Posts: 3
Joined: Tue Aug 01, 2006 5:27 pm
This problem looks simple, but with this code, I get RE.
Someone can explain me what's wrong?
The test case above gives correct result.

Code: Select all

``````Now AC
Input buffer overflow, what a silly error!
Thanks Martin Macko
``````
Last edited by ytsejam on Sat Aug 12, 2006 8:43 pm, edited 1 time in total.

leocm
New poster
Posts: 22
Joined: Fri Jul 21, 2006 9:44 am
Location: Brasil
I really don't know where is the mistake... Could anyone explain me?

Code: Select all

``````T every body!
``````
Last edited by leocm on Thu Aug 17, 2006 6:49 pm, edited 1 time in total.

Mushfiqur Rahman
Learning poster
Posts: 56
Joined: Tue Jun 13, 2006 5:18 pm
Location: (CSE, SUST) Sylhet, Bangladesh
Contact:

### Why I am getting WA? Help plzzzzzzzz

I am getting WA with this code.
Here is my code:

Code: Select all

``````Removed after AC
``````
Last edited by Mushfiqur Rahman on Sat Mar 03, 2007 3:21 pm, edited 1 time in total.

Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)
leocm wrote:I really don't know where is the mistake... Could anyone explain me?
Not working for:

Code: Select all

``````aaaaaa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
2
2 a b
4 a a``````
The correct output:

Code: Select all

``````Case #1: The encoding string is aabbaa.

``````
Your code outputs one 'a' less.

Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

### Re: Why I am getting WA? Help plzzzzzzzz

Mushfiqur Rahman wrote:I am getting WA with this code.
Here is my code:
Not working for the same test case as I've just posted above.