10716 - Evil Straw Warts Live

All about problems in Volume 107. 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
Victor Barinov
New poster
Posts: 24
Joined: Sun Oct 03, 2004 10:03 am

10716 - Evil Straw Warts Live

Post by Victor Barinov »

Can anybody explain how to sovle such problems?

cyfra
Experienced poster
Posts: 144
Joined: Thu Nov 22, 2001 2:00 am
Location: Gdynia, Poland

Post by cyfra »

Hi!

My solution (which got AC ;-) was quite simple :

for each letter find it's first and last occurence in current string.
select letter for which sum of distances from it's first occurence to beginning and from last one to the end is smallest.
"move it" I mean swap it's first occurence to beginning and last to the end.
and "eliminate" them --> now you have the word which is shorter.

you have to repeat until you have <=1 letters left.

(oh you have to look whether this word can be "swapped" into the palindrom first)

Good Luck

Post Reply

Return to “Volume 107 (10700-10799)”