Burrows-Wheeler Transform Post Mortem Back to Perl Golf

Accepted | Artistic/Unorthodox | Rejected

Referee comments are in italics. Blue rows denote golfer's best solution. Red text denotes special characters.

Accepted

ScoreGolferSubmit TimeCode
54.56 Stephen Turner Mon Nov 18 15:27:14 2002
-pl @==sort@$=map$_.shift@=,@@for@@=/\pL|,/g;$_=@$[$_]
OK, looks like this is equal with Rick, so I suppose I'd better get to work on the other algorithm now.

no comments :)

54.56 Stephen Turner Mon Nov 18 09:55:35 2002
-pl @==sort@$=map$_.shift@=,@@for@@=/\pL|,/g;$_=$$[$_]
Useful unicode property. PGAS needs more decimal places!
54.56 Rick Klement Thu Nov 14 18:16:53 2002
-lp @p=sort@@=map$_.shift@p,@=for@==/\pL|,/g;$_=@@[$_]
54.56 BoB (Best of Breed - referees) Thu Nov 14 15:45:39 2002
-lp @==sort@$=map$_.shift@=,@@for@@=/,|\pL/g;$_=$$[$_]
A real Bob solution: combining the code from many people
54.56 Jeff Moore Tue Nov 19 22:39:05 2002
-lp @==sort@p=map$_.shift@=,@@for@@=/,|\pL/g;$_=@p[$`]
55.55 Stephen Turner Mon Nov 18 08:25:09 2002
-pl @==sort@_=map$_.shift@=,@@for@@=/[=-_,]/g;$_=$_[$_]
Introducing a new intermediate variable actually saves characters for once.
55.55 Petri Mikkelä Mon Nov 18 16:03:47 2002
-lp @_=sort@$=map$_.shift@_,@@for@@=/[,=-_]/g;$_=$$[$_]
tiebreak-=6‰
55.55 Jasper McCrea Tue Nov 19 12:57:04 2002
-lp @==sort@$=map$_.shift@=,@@for@@=/[=-o,]/g;$_=@$[$_]
horrible, but probably brings me equal with the other guys
55.55 Jasper McCrea Tue Nov 19 12:09:42 2002
-lp @==sort@$=map$_.shift@=,@@for@@=/[=-o,]/g;$_=$$[$_]
strange that this works, and @ didn't

perldoc perldelta /interpolate

55.55 Michael Rybakin Tue Nov 19 15:06:58 2002
-lp @@=sort@$=map$_.shift@@,@=for@==/[,=-_]/g;$_=@$[$_]
-0.0038
55.55 Michael Rybakin Fri Nov 15 12:53:50 2002
-lp @@=sort@$=map$_.shift@@,@=for@==/[=-_,]/g;$_=$$[$_]
Closing in
55.55 Jeff Moore Tue Nov 19 02:27:16 2002
-lp @==sort@p=map$_.shift@=,@@for@@=/[=-p,]/g;$_=@p[$`]
55.56 Petri Mikkelä Mon Nov 18 15:33:52 2002
-lp @$=sort@_=map$_.shift@$,@@for@@=/[,;-_]/g;$_=$_[$_]
55.57 Jasper McCrea Mon Nov 18 21:12:48 2002
-lp @==sort@$=map$_.shift@=,@@for@@=/[A-Z,]/g;$_=$$[$_]
I'm crap at this tiebreak lark

Use the source, Luke

55.59 Alexey Rudenko Tue Nov 19 11:09:23 2002
-lp /\D/g;@s=sort@t=map$_.shift@s,@/for@/=//g;$_=$t[$`]
55.60 Jasper McCrea Mon Nov 18 15:11:39 2002
-lp @p=sort@o=map$_.shift@p,@;for@;=/[A-Z,]/g;$_=$o[$_]
took me rather too long to notice this, I think!

there is some _more_ time until tpr.

55.60 Jeff Moore Tue Nov 19 01:32:45 2002
-lp /\D/g;@s=sort@p=map$_.shift@s,@^_for@^_=//g;$_=@p[$`]
Down with whitespace!
56.59 Jeff Moore Tue Nov 19 01:00:33 2002
-lp /\D/g;@s=sort@p=map$_.shift@s,@o for@o=//g;$_=@p[$`]
I give. Why does this work with @p[$`] but not with @p[$_]?

seems impossible

56.61 Petri Mikkelä Sun Nov 17 15:34:12 2002
-lp @_=sort@x=map$_.shift@_,@y for@y=/[A-Z,]/g;$_=$x[$_]
57.55 BoB (Best of Breed - referees) Thu Nov 14 15:11:38 2002
-lp @$=map$_.(sort@$)[$@++%@@],@@for@@=/,|\pL/g;$_=$$[$_]
go bob go

yes, 60 barrier is broken!

57.55 Terje K Sat Nov 16 20:33:25 2002
-pl @@=map$_.(sort@@)[$@++%@=],@=for@==/\pL|,/g;$_=@@[$_]
57.56 Michael Rybakin Fri Nov 15 11:16:40 2002
-lp @@=sort@$=map$_.shift@@,@=for(@==/[=-_,]/g);$_=$$[$_]
58.55 Michael Wrenn Tue Nov 19 20:15:21 2002
-lp @@=map$_.(sort@@)[$@++%@=],@=for@==/[A-Z,]/g;$_=@@[$_]
How about this late entry?

it compiles, ship it!

58.58 Stephen Turner Sat Nov 16 00:26:31 2002
-pl @o=map$_.(sort@o)[$o++%@0],@0for@0=/[=-o,]/g;$_=$o[$_]
How do you feel about O(n^3 log n) algorithms? I estimate this would take several hours to complete test 28 on my slowish machine, but that would seem to be within the rules.

The rules give you about a week of runtime. And the problemsize has a maximum actually reached by test 28. So you're safe.

58.60 Jeff Moore Sun Nov 17 00:02:34 2002
-lp /^I/g;@s=sort@p=map$_.shift@s,@o for@o=/./g;$_=$p[$_+0]
59.51 Chris Dolan Tue Nov 19 14:53:05 2002
-pl @==sort@_=map$_.@=[$@++%@@],@@for@@=/[,=-_]/g;$_=@_[$_]
Finally!

Still lots of time...

59.59 Jeff Moore Sat Nov 16 22:58:00 2002
-lp @s=sort@p=map$_.shift@s,@_ for/^I/..split$p,$';$_=$p[$`]
61.55 BoB (Best of Breed - referees) Wed Nov 13 23:08:11 2002
-lpaF\d* @@=map$F[$@++%@@].$_,sort@@for@@[2..$#F];$_=@@[$_+2]
It just *had* to exist with all these 62's

Indeed

61.55 Terje K Sat Nov 16 09:54:08 2002
-pl /^I/;@@=map$_.(sort@@)[$@++%@=],@=for@==$'=~/./g;$_=@@[$_]
finally silence is broken, 9.5 hours since last submission
61.56 Michael Wrenn Tue Nov 19 18:56:25 2002
-lp @@=map$_.(sort@@)[$@++%@=],@=for@==/\D/g;$_=@@[++$_];chop
This may not fly, but I am desperate!
61.56 Terje K Fri Nov 15 20:12:53 2002
-pl /^I/;@$=map$_.(sort@$)[$/++%@=],@=for@==$'=~/./g;$_=$$[$_]
another slow one :)

yeees

61.56 Michael Rybakin Thu Nov 14 13:04:24 2002
-lp $@-=@$=map$_.(sort@$)[$@++],@@for(@@=/[A-Z,]/g);$_=$$[$_]
extremally short and slow

very nice but O(n**3*log n) is too much. sorry, rule #2. feel free to complain but in this case please prove that test 28 will finish in 7 days on let's say pentium 100 MHz.

61.63 Alexey Rudenko Sun Nov 17 11:02:35 2002
-lp @_=sort@a=map$_.shift@_,@*for@*=/[,A-Z]/g;/\d+/;$_=$a[$&]
duplicate?
61.63 Alexey Rudenko Sun Nov 17 10:41:46 2002
-lp @_=sort@a=map$_.shift@_,@*for@*=/[,A-Z]/g;/\d+/;$_=$a[$&]
62.52 BoB (Best of Breed - referees) Wed Nov 13 10:47:10 2002
-lp @==map$@[$@++%@@].$_,sort@=for@==@@{@@=/,|\pL/g};$_=@=[$_]
62.52 Michael Robinson Tue Nov 19 08:55:57 2002
-pl @$=@$?map@@[$@++%@@].$_,sort@$:@@for@@=/[A-Z,]/g;$_=$$[$_]
Eliminating that nasty 2.. construct saves several strokes.
62.53 BoB (Best of Breed - referees) Wed Nov 13 10:39:26 2002
-lp @==map$@[$@++%@@].$_,sort@=for@==@@{@@=/,|\pL/g};$_=$=[$_]
still algotithm No.2
62.53 Michael Rybakin Thu Nov 14 14:47:37 2002
-lp $@-=@@=sort@$=map$_.$@[$@++],@=for(@==/[=-_,]/g);$_=$$[$_]
+1 stroke, but fast enough now

sure.

62.55 Benoît Chauvet Mon Nov 18 16:53:36 2002
-lp @==@=?map$@[$c++%@@].$_,sort@=:@@for@@=/[,A-a]/g;$_=$=[$_]
A major improvement of the tiebreaker... I'm sure that Stephen or Rick would actually *love* to improve their score by 0.001 ! =)
62.55 Benoît Chauvet Mon Nov 18 15:39:10 2002
-lp @==@=?map$@[$c++%@@].$_,sort@=:@@for@@=/[^^I\d]/g;$_=$=[$_]
Back in the top 10... yeah ! =)

well done :)

62.56 BoB (Best of Breed - referees) Thu Nov 14 23:41:08 2002
-lp $_=$/++for sort@@=@$=/,|\pL/g;s//$\=$$[$_=@@[$_]].$\ /eg}{
Improve algorithm one tiebreak

Still far from algorithm 2

62.58 BoB (Best of Breed - referees) Wed Nov 13 21:55:10 2002
-lpaF\d+| @==map$F[$@++%@=].$_,sort@=for@=[2..$#F];$_=@=[$_+2]
And yet another 62

Ok BoB. time to stop fooling around and find a 61

62.59 gimbo Thu Nov 14 18:08:09 2002
-lp @,=@,?map$.[$l++%@.].$_,sort@,:@.for@.=/[A-Z,]/g;$_=$,[$_]
62.60 BoB (Best of Breed - referees) Wed Nov 13 17:23:14 2002
-pl $_=$i++for sort@b=@o=/,|\pL/g;s!!$\=$o[$_=$b[$_]].$\ !eg}{
Algorithm 1 is alive !

Looks familiar

63.52 Michael Wrenn Sun Nov 17 04:31:54 2002
-lp @@=map@=[$@++%@@].$_,sort@@for+3..(@@=@==/\D/g);$_=@@[++$_]
Shhh! ... I think all the others are asleep ... as I sneak past Chris and Amir with my better tie-break into 7th!
63.53 Chris Dolan Fri Nov 15 20:12:56 2002
-pl @@=map@=[$@++%@@].$_,sort@@for 3..(@@=@==/\D/g);$_=@@[++$_]
63.53 Amir Karger Mon Nov 18 04:06:44 2002
-lp @@=map@_[$@++%@@].$_,sort@@for@@=@_=/\pL|,/g;$_=@@[$_];chop
The last time I did this, my competitor got another 5 strokes the next day. But I'll do anything I can to claw my way back into the top 10, and I'm not having any success with whole numbers of strokes.
63.53 Amir Karger Mon Nov 18 04:06:03 2002
-lp @@=map@_[$@++%@@].$_,sort@@for@@=@_=/\pL|,/g;$_=@@[$_];chop
The last time I did this, my competitor got another 5 strokes the next day. But I'll do anything I can to claw my way back into the top 10, and I'm not having any success with whole numbers of strokes.
63.53 Amir Karger Mon Nov 18 04:03:34 2002
-lp @@=map@_[$@++%@@].$_,sort@@for@@=@_=/\pL|,/g;$_=@@[$_];chop
The last time I did this, my competitor got another 5 strokes the next day. But I'll do anything I can to claw my way back into the top 10, and I'm not having any success with whole numbers of strokes.
63.54 Amir Karger Fri Nov 15 19:01:09 2002
-lp @@=map$_[$@++%@@].$_,sort@@for@@=@_=/\pL|,/g;$_=@@[$_];chop
63.540: does it put me ahead of or tied with Terje?!

should be ;)

63.54 Terje K Fri Nov 15 15:49:58 2002
-pl /^I/;$==0,@$=map$_.(sort@$)[$=++],@=for@==$'=~/./g;$_=$$[$_]
63.55 Amir Karger Thu Nov 14 20:23:08 2002
-lp @@=map$_[$%++%@@].$_,sort@@for@@=@_=/\pL|,/g;$_=@@[$_];chop
The last time I tried \pL, it got rejected. But it's in the perl5.8.0 docs.

perhaps you meen some old golf

63.57 BoB (Best of Breed - referees) Wed Nov 13 01:10:54 2002
-lp @==map$o[$o++%@o].$_,sort@=for@o=@==/,|\pL/g;$_=$=[$_];chop
63.58 Rick Klement Wed Nov 13 16:58:26 2002
-lp @$=sort map$_.shift@$,@=for@==/\pL|,/g;$_=chop($;=$$[$_]).$
Trade the hated tabs for the hated \pL.

Good. I hated the tabs.

63.61 Jeff Moore Sat Nov 16 19:19:04 2002
-lp @r=sort@d=map$_.$r[$n++%@_],@_ for/^I/..split'',$';$_=$d[$`]
64.53 Chris Dolan Wed Nov 13 14:03:59 2002
-pl @@=map@=[$@++%@@].$_,sort@@for@@=@==/[A-Z,]/g;$_=@@[$_];chop
Playing with the tiebreaker
64.55 Michael Wrenn Sun Nov 17 00:44:30 2002
-lp @@=map$_[$@++%@@].$_,sort@@,for 3..(@@=@_=/\D/g);$_=$@[++$_]
Maybe this will wake up Eugene! Mooovin' on up ...
64.55 Bass Tue Nov 19 13:30:00 2002
-pl @;=map$$[$;++%@$].$_,sort@;for@;=@$=/[;-o,]/g;$_=$;[$_];chop
Bothering the Refs just to get ahead of (-ugene. Tiebreaker improved by draving an image of me drooling and winking.

good.

64.56 Stephen Turner Sat Nov 16 00:24:52 2002
-pl @o=sort(@o),@o=map$_.$o[$o++%@0],@0for@0=/[=-o,]/g;$_=$o[$_]
Algorithm 2, but don't sort the last time through.
64.56 Amir Karger Thu Nov 14 20:03:05 2002
-lp @@=map$_[$%++%@@].$_,sort@@for@@=@_=/[A-Z,]/g;$_=@@[$_];chop
I've never even been *close* to Eugene before! Not to mention in the top 10. Too bad it's only the second day!
64.56 Terje K Fri Nov 15 15:14:37 2002
-pl /^I/;for(@==$'=~/./g){@$=sort@$;@$=map$_.shift@$,@=}$_=$$[$_]
64.57 Chris Dolan Wed Nov 13 13:58:58 2002
-pl @==map@p[$p++%@p].$_,sort@=for@==@p=/[A-Z,]/g;$_=@=[$_];chop
one more stroke, obvious in retrospect

64 gains popularity :)

64.57 Eugene van der Pijll Tue Nov 19 22:41:21 2002
-pl @$=sort map$_.shift@$,@@for@@=/\pL|,/g;$$[$_]=~/.$/,$_=$&.$`
Another four days later, and this is the result: -0.002. And I don't think I can do better this time.
64.57 Eugene van der Pijll Fri Nov 15 22:30:54 2002
-pl @$=sort map$_.shift@$,@@for@@=/,|\pL/g;$$[$_]=~/.$/;$_=$&.$`
Three days of work, and my score is down by 0.02...

Repeat 5000 times (but a bit faster)

64.57 Benoît Chauvet Mon Nov 18 12:20:00 2002
-lp @==map$@[$c++%@@].$_,sort@=for@@=@==/[^^I\d]/g;$_=$=[$_];chop
Soooo easy when you finally find it !

try to complicate and squeeze it now

64.58 Rick Klement Wed Nov 13 05:55:27 2002
^I-lp/^I/g;@@=sort^Imap$_.shift@@,@/for@/=/./g;$_=chop($;=@@[$_]).$
Tiebreaker test
64.58 Michael Wrenn Sun Nov 17 00:02:37 2002
-lp @_=map$r[$r++%@_].$_,sort@_,for 3..(@_=@r=/\D/g);$_=$_[++$_]
Hah! Found 3 strokes! Top 10! Tied with Eugene! It must be a dream ... I hope I don't wake up until Tuesday

or that Eugene doesn't wake up...

64.58 Bass Tue Nov 19 12:27:38 2002
-pl @;=map$g[$g++%@g].$_,sort@;for@;=@g=/[=-g,]/g;$_=$;[$_];chop
looping once more wins 14 strokes

good

64.59 Rick Klement Wed Nov 13 05:39:17 2002
^I-lp/^I/g;@@=sort^Imap$_.shift@@,@;for@;=/./g;$_=chop($;=@@[$_]).$
Trying something strange for the tiebreaker.
64.59 Eugene van der Pijll Wed Nov 13 01:04:36 2002
-pl @_=sort map$_.shift@_,@@for@@=/,|\pL/g;$_[$_]=~/.$/;$_=$&.$`
65.55 Michael Robinson Mon Nov 18 23:04:24 2002
-pl @@=map@$[$@++%@@].$_,sort@@for 2..(@@=@$=/[A-Z,]/g);$_=$@[$`]
Since I can't see how to shave a stroke off, fiddle with the tiebreaker instead.
65.58 Qingning Huo Sat Nov 16 16:28:36 2002
-pl map{s=^=$o[$o++%@$]=for+sort@$}@o=@$=/[A-Z,]/g;$_=$$[$_];chop
65.58 Danny Rathjens Mon Nov 18 01:15:34 2002
-lp @$=sort map$_.shift@$,@@for@@=/[A-Z,]/g;$$[$_]=~/.$/;$_=$&.$`
65.59 Chris Dolan Wed Nov 13 05:15:18 2002
-lp @.=map$o[$a++%@o].$_,sort@.for 2..(@.=@o=/[A-Z,]/g);$_=$.[$_]
A couple hours and 10 Algorithm 1 solutions later, I can only get a one character gain via Algorithm 2. :-(

There's plenty of time to improve it. And, there doesn't seem to be too much competition. Yet!

65.59 Eugene van der Pijll Wed Nov 13 00:56:33 2002
-pl @_=sort map$_.shift@_,@@for@@=/[A-Z,]/g;$_[$_]=~/.$/;$_=$&.$`
65.61 Jasper McCrea Thu Nov 14 23:44:21 2002
-lp @o=sort map$_.shift@o,@;for@;=/[,A-Z]/g;$o[$_]=~/.$/;$_=$&.$`
65.62 Michael Robinson Mon Nov 18 22:28:20 2002
-pl @!=map$m[$0++%@!].$_,sort@!for 2..(@!=@m=/[A-Z,]/g);$_=$![$`]
D'oh! And I can remove the -a autosplit, of course.
66.57 Qingning Huo Fri Nov 15 19:50:54 2002
-pl for(@o=@$=/[A-Z,]/g){s=^=$o[$o++%@$]=for sort@$}$_=$$[$_];chop
66.58 szeryf Tue Nov 19 22:35:01 2002
^I-pl@$=sort^Imap$_.shift@$,@_^Ifor/^I/+1..split//,$';$_=$_[$`].$$[$`]
still got to get rid of that +1 thingie /:

Will this keep Paul back ? ....

66.59 Adam Antonik Fri Nov 15 11:11:18 2002
-lp /^I/g;{@_=sort map$_.shift@_,@@for@@=/./g}$_[$`]=~/.$/;$_=$&.$`
66.60 Chris Dolan Wed Nov 13 00:38:05 2002
-lp @a=map$o[$a++%@a].$_,sort@a for 2..(@a=@o=/[A-Z,]/g);$_=$a[$_]
66.60 gimbo Thu Nov 14 16:26:55 2002
-lp @c=@,=/[A-Z,]/g;@,=map$c[$l++%@c].$_,sort@,for 2..@c;$_=$,[$_]
66.60 Michael Rybakin Thu Nov 14 10:50:58 2002
-lp for(@A=/[A-Z,]/g){@m=sort@m;$p%=@m=map$_.$m[$p++],@A}$_=$m[$_]
66.62 Michael Robinson Mon Nov 18 22:24:34 2002
-apl @!=map$m[$0++%@!].$_,sort@!for 2..(@!=@m=/[A-Z,]/g);$_=$![$`]
I don't understand why "5\cIOBRSDD" is a valid array index, but never mind, it is shorter.

man atoi

67.56 Paul van Eldijk Tue Nov 19 18:03:12 2002
-alp split//,@F[1];@@=map$_.(sort@@)[$@++%@_],@_ for@_;$_=@@[@F[0]]
67.57 Michael Wrenn Sat Nov 16 22:58:18 2002
-lp map$_=$r[$r++%@_].$_,@_=sort@_,for 3..(@_=@r=/\D/g);$_=$_[++$_]
I'm still searching for that multi stroke breakthrough ...
67.57 Terje K Thu Nov 14 15:10:23 2002
-pl /^I/;@$=sort map$_.shift@$,@=for@==$'=~/./g;$_=chop($;=$$[$_]).$
slightly more obfuscated to please the tiebreaker

obfuscating is good

67.58 szeryf Tue Nov 19 18:02:37 2002
^I-pl/^I/;@$=sort^Imap$_.shift@$,@_^Ifor^I2..split//,$';$_=$_[$`].$$[$`]
slightly improved tie-break by s/ /\t/'ing (-:
67.58 szeryf Sun Nov 17 09:43:02 2002
-pl /^I/;@$=sort map$_.shift@$,@_ for 2..split//,$';$_=$_[$`].$$[$`]
I just wanted to ask, why was I promoted to veteran status without any notice or my decision?

actually we thought that it was done by yourself. please send an email to mtve.

67.58 Paul van Eldijk Tue Nov 19 17:57:04 2002
-alp split//,$F[1];@@=map$_.(sort@@)[$@++%@_],@_ for@_;$_=@@[$F[0]]
67.59 Qingning Huo Fri Nov 15 18:21:26 2002
-pl for(@o=@p=/[A-Z,]/g){map$_=$o[$p++%@p].$_,sort@p}$_=$p[$_];chop
67.59 Paul van Eldijk Tue Nov 19 17:34:51 2002
-alp split//,$F[1];@$=map$_.(sort@$)[$p++%@_],@_ for@_;$_=@$[$F[0]]
67.60 Terje K Thu Nov 14 10:48:03 2002
-pl /^I/;@f=sort map$_.shift@f,@;for@;=$'=~/./g;$_=chop($;=$f[$_]).$
doh again .. must stop coding with my eyes closed :)

wow you golfed with closed eyes?

67.60 Michael Rybakin Thu Nov 14 10:04:52 2002
-lp for(@A=/[A-Z,]/g){@m=sort@m;$p=0;@m=map$_.$m[$p++],@A}$_=$m[$_]
that's better.
67.61 Mark Hillebrand Fri Nov 15 10:01:37 2002
-lp @B=@A=/[A-Z,]/g;@B=map$A[$i++%@A].$_,sort@B for 2..@A;$_=$B[$_]
with algorithm 2!
67.62 BoB (Best of Breed - referees) Wed Nov 13 16:35:03 2002
-pal $_=$i++for sort@b=@o=/,|\pL/g;$\=$o[(@F=@b[@F])[0]].$\ for@o}{
Currently the shortest known algorithm 1 solution

go bob!

67.63 Qingning Huo Fri Nov 15 18:14:47 2002
-pl for(@x=@y=/[A-Z,]/g){map$_=$x[$i++%@x].$_,sort@y}$_=$y[$_];chop
hey, are we fast? :)
68.56 Michael Wrenn Fri Nov 15 23:35:56 2002
-lp @r=@_=/\D/g;map$_=$_[$r++%@_].$_,@r=sort@r,for 3..@_;$_=$r[++$_]
++Tie-break points. I want #12 all mine!
68.57 Michael Wrenn Fri Nov 15 23:23:43 2002
-lp @s=@_=/\D/g;map$_=$_[$s++%@_].$_,@s=sort@s,for 3..@_;$_=$s[++$_]
I worked on the tie-braek a bit, but I can only see 2 decimals on the board. I may not move up much.
68.57 Benoît Chauvet Wed Nov 13 17:39:38 2002
-lp /^I/;{@==map$@[$}++%@@].$_,sort@=for@@=@==$'=~/./g}$_=$=[$`];chop
One stroke is one stroke !

Especially if you do it six more times

68.57 pom Fri Nov 15 12:11:49 2002
-lp /^I/;@==sort map$_.shift@=,@;for@;=$'=~/./g;$=[$_]=~/.$/;$_=$&.$`
68.58 Benoît Chauvet Wed Nov 13 23:03:22 2002
-lp s/.*^I//;{@==map$@[$}++%@@].$_,sort@=for@@=@==/./g}$_=$=[$&];chop
Not better, but I keep trying...
68.58 Daniel Tuijnman Tue Nov 19 13:00:15 2002
-lpa split//,$F[1];@$=map{@$=sort@$;$_.shift@$}@_ for@_;$_=$$[$F[0]]
68.59 Eugene van der Pijll Wed Nov 13 00:45:06 2002
-apl @_=sort map$_.shift@_,@@for@@=@F[1]=~/./g;$_[$_]=~/.$/;$_=$&.$`
I've got to castch Chris before I go to bed
68.63 Qingning Huo Fri Nov 15 18:11:11 2002
-pl for(@x=@y=/[^\d\s]/g){map$_=$x[$i++%@x].$_,sort@y}$_=$y[$_];chop
69.56 Ala Qumsieh Tue Nov 19 17:52:46 2002
-pl @$=sort map$_.$$[$i++%@@],@@for@@=/[A-Z,]/g;$$[$_]=~/.$/;$_=$&.$`
squeezing a bit more juice out of this one ...
69.57 Stephen Turner Thu Nov 14 18:33:19 2002
-pl @p=sort+map$_.$p[$p++%@0],@0for@0=/[A-p,]/g;$_=chop($p=$p[$_]).$p
Using Ton's Algorithm 2.

wrong guess now :)

69.58 Benoît Chauvet Wed Nov 13 17:10:33 2002
-lp /^I/;@==map$@[$}++%@@].$_,sort@=for@@=@==split//,$';$_=$=[$`];chop
I can't believe I'm in the same 10 than the aliens...

Aliens are highly overrated

69.59 Michael Wrenn Fri Nov 15 15:24:36 2002
-lp @s=@_=/\D/g;for(3..@_){@s=map$_=$_[$i++%@_].$_,sort@s}$_=$s[$_+1]
A few more strokes sh?aved! But I have a mysteriously increasing counter ...
69.59 Jasper McCrea Thu Nov 14 11:43:06 2002
-lp @p=sort map$_.$p[$i++%@;],@;for@;=/[,A-Z]/g;$p[$_]=~/.$/;$_=$&.$`
Works in 5.6, anyway
69.61 Terje K Thu Nov 14 10:44:18 2002
-pl /^I/;@f=sort map$_.shift@f,@;for(@;=$'=~/./g);$_=chop($;=$f[$_]).$
doh .. almost on a decent level now :)

mmm, not yet :)

69.61 pom Fri Nov 15 12:04:05 2002
-pal @s=sort map$_.shift@s,@;for@;=pop(F)=~/./g;$s[$_]=~/.$/;$_=$&.$`
Just one stroke better...
69.62 Michael Robinson Fri Nov 15 06:18:04 2002
-apl @!=map$m[$a++%@!].$_,sort@!for 2..(@!=@m=/[A-Z,]/g);$_=$![$F[0]]
Further refinements -- I finally realised that a variable rename would let me deal to the space between the sort and the for loop.
70.57 Daniel Tuijnman Tue Nov 19 01:54:50 2002
-lpa split//,$F[1];@$=map$_[$_].(sort@$)[$_],0..$#_ for@_;$_=$$[$F[0]]
70.58 Daniel Tuijnman Mon Nov 18 23:53:47 2002
-lpa split//,@F[1];@$=map$_[$_].(sort@$)[$_],0..$#_ for@_;$_=$$[$F[0]]
Notice that you are *not* the leading beginner, that is szeryf with a score of 67.58. He somehow got promoted to veteran by someone else. We'll try to get his status fixed.
70.59 pom Thu Nov 14 01:15:02 2002
-pl /^I/;@s=sort map$_.shift@s,@;for@;=split//,$';$s[$`]=~/.$/;$_=$&.$`
Oops, sorry -- I think there was a copy/paste mistake in my previous submission. This should be better (70.588 according to the test program)

Good start. congratulations on your birthday and your becoming a doctor!

70.60 Daniel Tuijnman Mon Nov 18 03:49:34 2002
-lpa split//,@F[1];@s=map$_[$_].(sort@s)[$_],0..$#_ for@_;$_=$s[$F[0]]
71.57 szeryf Fri Nov 15 21:48:07 2002
-pl /^I/;@$=sort map$_.$$[$p++%@_],@_ for 2..split//,$';$_=$_[$`].$$[$`]
71.58 Benoît Chauvet Wed Nov 13 16:27:49 2002
-lp s/.*^I//;@==map{$@[$c++%@@].$_}sort@=for@@=@==split//;$_=$=[$&];chop
Ok, the last one was difficult to make it run, but why don't you have a machine with 2Go RAM as a judge ?! ;) Anyway, this one is far better...

good

71.59 Michael Wrenn Fri Nov 15 15:15:57 2002
-lp @s=@_=/[A-Z,]/g;for(2..@_){@s=map$_=$_[$i++%@_].$_,sort@s}$_=$s[$_]
A quick submission while my 73 is still pending. How foolish to overlook parens!
72.59 Amir Karger Thu Nov 14 18:50:48 2002
-lpa $_=pop@F;split//;@%=map$_[$c++%@%].$_,sort@%for@%=@_;$_=@%[@F];chop
I don't want to stay in last place for too long...

good, for the moment there was an illusion that such code is prohibited by someone :)

72.59 szeryf Fri Nov 15 18:54:16 2002
-pl /\t/;@t=sort map$_.$t[$t++%@_],@_ for 2..split//,$';$_=$_[$`].$t[$`]
72.60 Smylers Mon Nov 18 09:57:27 2002
-lp s/.+^I//;split//;@,=sort map$_.shift@,,@_ for@_;$,[$&]=~/.$/;$_=$&.$`
72.62 Giovans Fri Nov 15 07:40:09 2002
-lp /\t/;split??,$';@b=sort map$_.shift@b,@_ for@_;$_=$_[$`].$b[$`];chop
73.56 Lars Mathiesen Tue Nov 19 17:36:52 2002
-lp /^I/g;map$_=$l++.$_,sort@_=/./cg;s/\d+/$_[$&]/while~$l--;s///;s/.^I.*//
73.60 Michael Wrenn Fri Nov 15 14:38:03 2002
-lp @s=@_=(/[A-Z,]/g);for(2..@_){@s=map$_=$_[$i++%@_].$_,sort@s}$_=$s[$_]
Finally back at 73, within memory limits! Only 4 more to the next spot!
73.60 Jeff Moore Sat Nov 16 19:01:17 2002
-lpX @r=sort map$_.$r[$n++%@_],@_ for/^I/..split'',$';$_=$r[$`];$_=chop.$_
Jeff, we're sorry, please ignore previous rejection.
73.60 Jeff Moore Sat Nov 16 18:37:06 2002
-lpX @r=sort map$_.$r[$n++%@_],@_ for/^I/..split'',$';$_=$r[$`];$_=chop.$_
73.61 Ala Qumsieh Tue Nov 19 07:02:15 2002
-pl @q=/[A-Z,]/g;@f=sort map$_.$f[$i++%@q],@q for@q;$f[$_]=~/.$/;$_=$&.$`
A bit better .. not much though :( Please change my email address or messages will bounce back! ala_qumsieh@yahoo.com.
73.62 Terje K Thu Nov 14 10:25:23 2002
-pl /^I/;@f=sort map$_.shift@f,@;for(1)x(@;=$'=~/./g);$_=chop($;=$f[$_]).$
not dead yet this horse :)

run horse run!

74.60 Qingning Huo Thu Nov 14 16:24:53 2002
-pl s/\d+.//;for(@s=@p=split//){map$_=$s[$p++%@s].$_,sort@p}$_=$p[$&];chop
74.60 Eugene van der Pijll Wed Nov 13 00:38:53 2002
-apl @Y=sort map$_.$Y[$n++%@@],@@for@@=split'',pop@F;$Y[$_]=~/.$/;$_=$&.$`
A few obvious improvements. But at least I have been at the top of the board.
74.60 Jaska Kivelä Wed Nov 13 14:29:47 2002
-pla map{$t=0;@o=sort@o;$o[$t++]=~s/^/$_/for@s}@s=$F[1]=~/./g;$_=$o[$F[0]]
74.60 Daniel Tuijnman Mon Nov 18 03:29:19 2002
-lpa split//,@F[1];@s=map$_[$_].(sort@s)[$_],0..$#_ for 1..@_;$_=$s[$F[0]]
74.61 Jasvir Nagra Mon Nov 18 22:38:14 2002
-lp /^I/;@n=@l=split//,$';@l=map{$n[$i++%@n].$_}sort@l for@n;$_=$l[$`];chop
Pity. This looked promising...
74.64 Qingning Huo Thu Nov 14 14:00:10 2002
-pl s/\d+.//;for(@x=@y=split//){map$_=$x[$i++%@x].$_,sort@y}$_=$y[$&];chop
74.64 Giovans Thu Nov 14 13:58:04 2002
-lp /\t/;split??,$';for(@_){@b=sort map$_.shift@b,@_}$_=$_[$`].$b[$`];chop
75.56 Eike Grote Sun Nov 17 08:59:14 2002
-lp ($@,$_)=split;$j=0,@@=map$$[$j++].$_,sort@@for@@=@$=/./g;$_=$@[$@],chop
75.56 Paul van Eldijk Tue Nov 19 16:28:54 2002
-alp split//,$F[1];@$=@_;@$=map$_[$p++%@$].$_,sort@$ for@F..@$;$_=$$[$F[0]]
75.59 szeryf Fri Nov 15 08:44:52 2002
-pl /\t/;split//,$';@t=sort map$_.$t[$t++%@_],@_ for 2..@_;$_=$_[$`].$t[$`]
duplicate?
75.59 szeryf Fri Nov 15 08:44:29 2002
-pl /\t/;split//,$';@t=sort map$_.$t[$t++%@_],@_ for 2..@_;$_=$_[$`].$t[$`]
8 chars, nice effort!
75.59 Martien Verbruggen Tue Nov 19 04:43:53 2002
-lp /\t/;@_=sort map$_.$_[$/++%@;],@;for@;=split'',$';$_[$`]=~/.$/;$_=$&.$`
75.60 Michael Wrenn Fri Nov 15 00:35:55 2002
-lp @s=@_=(/[A-Z,]/g);for(2..@_){$i=0;@s=map$_=$_[$i++].$_,sort@s}$_=$s[$_]
Thwarted at 73, I move on with an easy one stroke, with hopes of more to come soon!
75.60 Jeff Moore Fri Nov 15 03:27:48 2002
-lpaX @r=sort map$_.$r[$n++%@c],@c for@c=$F[1]=~/./g;$_=$r[$_+0];$_=chop.$_
75.60 Martien Verbruggen Tue Nov 19 04:18:08 2002
-lp /\t/;@a=sort map$_.$a[$i++%@;],@;for@;=split'',$';$a[$`]=~/.$/;$_=$&.$`
75.61 Michael Robinson Thu Nov 14 21:45:59 2002
-apl @x=@w=$F[1]=~/./g;$i=0,@x=map$w[$i++].$_,sort@x for 2..@w;$_=$x[$F[0]]
First cut using the second approach. I'm fairly sure that the leaders are using the first approach, but this seemed quicker to implement.
75.62 Terje K Thu Nov 14 10:09:43 2002
-pl /^I/;@f=sort map$_.shift@f,@;for(1)x(@;=split//,$');$_=chop($;=$f[$`]).$
75.64 Giovans Thu Nov 14 11:32:16 2002
-lp /\t/;split??,$';for(@_){@b=sort map{$_.shift@b}@_}$_=$_[$`].$b[$`];chop
76.60 Michael Wrenn Thu Nov 14 21:16:53 2002
-lp @s=@_=(/[A-Z,]/g);for(2..@_){$i=0;@s=map{$_=$_[$i++].$_}sort@s}$_=$s[$_]
Not a Top 10, but not a bad start. I couldn't best 130 with the first algorithm! But I had fun trying

good start!

76.61 Jeff Moore Fri Nov 15 02:44:29 2002
-lpa @r=sort map$_.$r[$n++%@c],@c for@c=$F[1]=~/./g;$_=$r[$_+0];$_=chop().$_
76.62 Terje K Wed Nov 13 22:08:21 2002
-pl /^I/;@f=sort map$_.shift@f,@;for(1)x(@;=split//,$');$_=chop($_=$f[$`]).$_
76.62 Jasvir Nagra Mon Nov 18 20:36:37 2002
-lp /^I/;@n=@l=split//,$';for(2..@n){@l=map{$n[$i++].$_}sort@l;$i=0}$_=$l[$`]
Well it works with 5.6.1 - we'll see about 5.8 shall we. =)
76.63 Peter Haworth Thu Nov 14 19:53:36 2002
-pla for(@y=@x=$F[1]=~/./g){$q=0;s/^/$x[$q++]/for@y=sort@y}$_=$y[$F[0]];chop
Algorithm 2 seemed simple enough, so here it is
77.57 Paul van Eldijk Tue Nov 19 16:17:19 2002
-alp split//,$F[1];@$=@_;$j=0,@$=map$_[$j++].$_,sort@$ for@F..@$;$_=$$[$F[0]]
77.58 Joe Baldassini Tue Nov 19 15:25:17 2002
-alp @s=@p=split//,pop@F;for(2..@s){$s=0;s//$p[$s++]/for@s=sort@s}$_=$s["@F"]
77.59 Chris Dolan Tue Nov 12 23:51:22 2002
-ap $c=0,@a=map$o[$c++].$_,sort@a for@a=@o=split//,pop@F;$_=$a[pop@F];s/.$/
/
First post
77.59 Jaska Kivelä Wed Nov 13 14:13:45 2002
-pla @s=$F[1]=~/./g;map{$t=0;@o=sort@o;$o[$t++]=~s/^/$_/for@s}@s;$_=$o[$F[0]]
One down. Plenty to go.
77.60 Martien Verbruggen Tue Nov 19 04:00:25 2002
-lpa @a=sort map$_.$a[$i++%@;],@;for@;=split'',$F[1];$a[$F[0]]=~/.$/;$_=$&.$`
77.61 Daniel Tuijnman Mon Nov 18 03:01:08 2002
-lpa @f=split//,@F[1];@s=map$f[$_].(sort@s)[$_],0..$#f for 1..@f;$_=$s[$F[0]]
78.56 Chris Dolan Tue Nov 19 19:00:32 2002
-pl @_=sort map$_ x$;++,@==/\D/g;$,.=$=[$_],$_=length$_[$_]for(++$_)x$#_;$_=$,
This is the best I could do on algorithm 1...

Nice

78.57 Bass Tue Nov 19 11:12:52 2002
-pl $#p=$#g,@p=sort map$g[$g++%@g].$_,@p for@g=/[=-g,]/g;$p[$_]=~/.$/;$_=$&.$`
gave up, upgraded perl, found the problem, hopefully got out of the sand trap. urgh.

great escape.

78.58 Paul van Eldijk Tue Nov 19 14:47:40 2002
-alp split//,$F[1];@$=@_;$j=0,@$=map$_[$j++].$_,sort@$ for(2..@$);$_=$$[$F[0]]
78.59 Joe Baldassini Tue Nov 19 10:44:50 2002
-apl @s=@f=split//,pop@F;for(2..@s){$s=0;s/^/$f[$s++]/for@s=sort@s}$_=$s["@F"]
78.60 Jaska Kivelä Wed Nov 13 12:49:31 2002
-pla ($n,$_)=@F;@a=/./g;map{$x=0;@b=sort@b;$b[$x++]=~s/^/$_/for@a}@a;$_=$b[$n]
Ok. <80 now. What next?-)

<70! :)

78.61 Scott Hall Tue Nov 19 04:47:13 2002
-nla print map$.[@F=$a[$a="@F"],$a],@a=map{y.1..}sort map$_.1x$a++,@.=/,|\pL/g
78.61 Paul van Eldijk Tue Nov 19 01:13:52 2002
-alp @t=@s=split//,$F[1];$j=0,@t=map$s[$j++].$_,sort@t for(2..@s);$_=$t[$F[0]]
79.58 Joe Baldassini Fri Nov 15 21:44:07 2002
-apl @s=@f=split//,pop@F;for(2..@s){$s=0;s/^/$f[$s++]/for@s=sort@s}$_=$s[pop@F]
cut and paste problem with previous submission
79.60 Martien Verbruggen Tue Nov 19 03:57:55 2002
-lpa $i=0,@a=sort map$_.$a[$i++],@;for@;=split'',$F[1];$a[$F[0]]=~/.$/;$_=$&.$`
79.60 Martien Verbruggen Tue Nov 19 03:57:10 2002
-lpa $i=0,@a=sort map$_.$a[$i++],@;for@;=split'',$F[1];$a[$F[0]]=~/.$/;$_=$&.$`
79.60 Martien Verbruggen Tue Nov 19 03:56:36 2002
-lpa $i=0,@a=sort map$_.$a[$i++],@;for@;=split'',$F[1];$a[$F[0]]=~/.$/;$_=$&.$`
79.60 Martien Verbruggen Tue Nov 19 03:56:16 2002
-lpa $i=0,@a=sort map$_.$a[$i++],@;for@;=split'',$F[1];$a[$F[0]]=~/.$/;$_=$&.$`
Did you press reload a few times when submitting? There are 4 identical submissions with this score.
80.61 Jaska Kivelä Wed Nov 13 12:41:48 2002
-pl ($n,$_)=split;@a=/./g;map{$x=0;@b=sort@b;$b[$x++]=~s/^/$_/for@a}@a;$_=$b[$n]
80.61 Paul van Eldijk Tue Nov 19 00:32:04 2002
-alp @t=@s=split//,$F[1];for(1..$#s){$j=0;@t=map{$s[$j++].$_}sort@t}$_=$t[$F[0]]
80.65 Giovans Thu Nov 14 07:37:40 2002
-lp /(\d+)\t/;split??,$';for(@_){@b=sort map{$_.shift@b}@_}$_=$_[$1].$b[$1];chop
81.59 Martien Verbruggen Fri Nov 15 05:51:51 2002
-lpa ($n,$_)=@F;$i=0,@a=sort map$_.$a[$i++],@;for@;=split'';$a[$n]=~/.$/;$_=$&.$`
81.61 Stephen Turner Thu Nov 14 18:32:15 2002
-pl @r=sort map$_ x++$j,@b=/[A-Z,]/g;$a.=$b[$_],$_=-1+length$r[$_]while$j--;$_=$a
Using Ton's Algorithm 1.

mmm, Ton's? how did you know that? :)

81.62 Daniel Tuijnman Mon Nov 18 02:22:23 2002
-lp ($i,@f)=split/\s|(?=\D)/;@s=map$f[$_].(sort@s)[$_],0..$#f for 1..@f;$_=$s[$i]
82.61 Terje K Wed Nov 13 21:54:55 2002
-pl /^I/;$f=0,@f=sort map$_.$f[$f++],@;for(1)x(@;=split//,$');$_=chop($_=$f[$`]).$_
hmm .. this one should work :)
82.61 Paul van Eldijk Tue Nov 19 00:22:20 2002
-alp ($i,$_)=@F;@t=@s=split//;for(1..$#s){$j=0;@t=map{$s[$j++].$_}sort@t}$_=$t[$i]
83.54 Ala Qumsieh Sat Nov 16 23:53:48 2002
-pl @$=/[A-Z,]/g;@_=sort map"$$[$_]$_[$_]",0..$#$ for 0..$#$;$_[$_]=~/.$/;$_="$&$`"
I just don't have time this month. Sorry for my excessive use of '$'s.

Good for the tiebreak though

83.54 Scott Hall Mon Nov 18 21:18:13 2002
-lp @.=sort(map$.[$_]=$_[$_].$.[$_],0..$#_)for/^I/..split//,$';$.[$`]=~/.$/;$_=$&.$`
83.57 szeryf Fri Nov 15 08:11:48 2002
-pl /\t/;split//,$';@t=sort map$t[$t++]=$_.$t[$t%=@_],@_ for 2..@_;$_=$_[$`].$t[$`]
83.58 Alain "TopMach" Dupuis Tue Nov 19 20:38:18 2002
-lpa for(@o=/[;-r,]/g){$r[$r++%@o]=~s/^/$_/for@o;@r=sort@r}$r[$F[0]]=~/.$/;$_=$&.$`
Sorry for making you work for tiny tiebreak points Mtv. :/

it's our privilege and job! everybody should obey rule #4: submit often!

83.60 Olivier Blanchard Thu Nov 14 14:40:02 2002
-l $_=<>;/\t/;{@r=@t=$'=~/./g}for(2..@r){$r=0;@r=map{$t[$r++].$_}sort@r}print$r[$`]
83.61 Alain "TopMach" Dupuis Thu Nov 14 15:00:00 2002
-lpa for(@%=/[A-Z,]/g){$t[$p++%@%]=~s/^/$_/for@%;@t=sort@t}$t[$F[0]]=~/.$/;$_=$&.$`
83.61 Jeff Moore Wed Nov 13 07:10:22 2002
-lpa for(@c=$F[1]=~/./g){$_.=$r[$n++%@c]for@d=@c;@r=sort@d}$_=$r[$_+0];$_=chop().$_
84.60 Scott Hall Thu Nov 14 05:25:34 2002
-alp ($F,$_)=@F;$g{$_ x++$.}=$;++for@.=/./g;s//$.[$F=$g{(sort keys%g)[$o=$F]},$o]/ge
Sorry that test 28 takes so long. Putting the sort inside the s/// saved a couple of strokes :)
84.60 Joe Baldassini Fri Nov 15 13:38:43 2002
-apl ($i,$_)=@F;@s=@i=split//;for(1..$#i){$l=0;s/^/$i[$l++]/for(@s=sort@s)}$_=$s[$i]
85.59 BigrTex Mon Nov 18 20:51:20 2002
-lp @s=/[,A-Z]/g;for(@s){@_=sort map{$s[$_].$_[$_]}0..$#s}$_=substr$s[$_].$_[$_],0,-1
@r => @_ lowers my tiebreaker, putting me ahead of a veteran on the $ list, but not affecting my placement on the beginner list. I had planned to try to golf the other algorithm over the weekend, but didn't find time. I may or may not find time this week.
85.60 Alain "TopMach" Dupuis Thu Nov 14 13:49:58 2002
-lpa for(@%=$F[1]=~/./g){$t[$p++%@%]=~s/^/$_/for@%;@t=sort@t}$t[$F[0]]=~/.$/;$_=$&.$`
85.60 BigrTex Fri Nov 15 01:19:40 2002
-lp @s=/[,A-Z]/g;for(@s){@r=sort map{$s[$_].$r[$_]}0..$#s}$_=$s[$_].substr$r[$_],0,-1
one of the cardinal rules of perl golf, "look and see if there are any characters you don't need." saves me 2 strokes, and I'll have to read the documentation to understand. I took out the parens around the character class in the RegEx and it still works.
85.60 TilRMan Thu Nov 14 10:04:27 2002
-alp split//,$F[1];for(@_){my$i;$a[$i++]=~s//$_/for@_;@a=sort@a}$a[$_]=~/.$/;$_=$&.$`
85.65 Amir Karger Sun Nov 17 06:59:20 2002
-ln @w=($_+1,map length,sort map{$_ x++$c}@u=/\pL|,/g);
print map$u[($p=$w[$p])-1],@u
Best I can do so far on algorithm 2
86.57 Nicolas Mendoza Sat Nov 16 10:06:42 2002
-pla for($F[1]=~/./g){@o=sort@o;$r=0;for($F[1]=~/./g){$o[$r]=$_.$o[$r];$r++}}$_=$o[$_]
And now with some more tweakes. I doubt I can get it any better using conventional syntax.

you mean conventional _golf_ syntax? are you sure? :)

87.55 Scott Hall Wed Nov 13 21:59:03 2002
-lp (map$.[$_]=$_[$_].$.[$_],0..@_-1),@.=sort@.for/^I/..split//,$';$.[$`]=~/.$/;$_=$&.$`
87.59 TilRMan Thu Nov 14 05:42:54 2002
-alp split//,$F[1];for(@_){$a[$_]=~s//$_[$_]/for
0..$#_;@a=sort@a}$a[$_]=~/.$/;$_=$&.$`
87.60 BigrTex Fri Nov 15 01:14:22 2002
-lp @s=/([,A-Z])/g;for(@s){@r=sort map{$s[$_].$r[$_]}0..$#s}$_=$s[$_].substr$r[$_],0,-1
What the heck, move up another spot... I'm amazing myself. I was counting in my for loop, but not using the numbers, so I can just use the elements of the array, saving 4 strokes. I can't use the same trick in the map because there I am actually using the numbers.
87.61 Eugene van der Pijll Wed Nov 13 00:28:10 2002
-apl @X=split'',pop@F;$#Y=$#X;@Y=sort map{$X[$n++%@X].$_}@Y for@X;$Y[$_]=~/.$/;$_=$&.$`
Nothing special, just a straightforward implementation of algorithm 2 to get on the leaderboard
87.61 Alain "TopMach" Dupuis Thu Nov 14 04:41:35 2002
-lp ($i,@%)=/\d+|\S/g;for(@%){$t[$p++%@%]=~s/^/$_/for@%;@t=sort@t}$t[$i]=~/.$/;$_=$&.$`
87.61 Marius Ascheberg Wed Nov 13 17:44:42 2002
-pl s/.+^I//;eval'$a[pos]=$&.$a[pos]while/./g;@a=sort@a;'x y///c;$_=chop($a=$a[$&+1]).$a
So let's go to the king class.

Royally accepted

87.62 Jeff Moore Wed Nov 13 06:39:40 2002
-lpa for(@c=$F[1]=~/./g){$r[$n++%@c]=~s/^/$_/e for@c;@r=sort@r}$_=$r[$_+0];$_=chop().$_
88.56 Scott Hall Wed Nov 13 05:21:43 2002
-lp (map$.[$_]=$_[$_].$.[$_],0..@_-1),@.=sort@.for/^I/..split//,$';$_=$.[$`];$_=(chop).$_
88.59 szeryf Thu Nov 14 08:41:16 2002
-pl /\t/;split//,$';@a=sort map$a[$a++]=$_.$a[$a%=@_],@_ for 1..@_;$a[$`]=~/.$/;$_=$&.$`
88.62 Olivier Blanchard Thu Nov 14 14:00:58 2002
-l $_=<>;/\t/;$n=$`;@u=@t=$'=~/./g;for(2..@t){$i=0;@u=map{$t[$i++].$_}sort@u}print$u[$n]
89.56 Nicolas Mendoza Sat Nov 16 11:01:55 2002
-pl /^I/;$t=$';for($t=~/./g){@o=sort@o;$r=0;for($t=~/./g){$o[$r]=$_.$o[$r];$r++}}$_=$o[$_]
wonder if the non-\t tab works too

surprise :)

89.57 Nicolas Mendoza Sat Nov 16 09:57:47 2002
-pla for($F[1]=~/./g){@o=sort@o;$r=0;for($F[1]=~/./g){$o[$r]=$_.$o[$r];$r++}}$_=$o[$F[0]]
Wonder if iterating strings are better....
89.61 Daniel Tuijnman Mon Nov 18 01:39:19 2002
-ln ($i,@f)=split/\s|(?=\D)/;@s=sort map$f[$_].$s[$_],0..$#f for 2..@f;print$f[$i],$s[$i]
89.62 Martien Verbruggen Fri Nov 15 05:49:20 2002
-lna ($n,$_)=@F;$i=0,@a=sort map$_.$a[$i++],@;for 1..(@;=split'');$a[$n]=~/.$/;print$&,$`
90.56 Nicolas Mendoza Sat Nov 16 11:03:01 2002
-pl /\t/;$t=$';for($t=~/./g){@o=sort@o;$r=0;for($t=~/./g){$o[$r]=$_.$o[$r];$r++}}$_=$o[$_]
back to the future
90.59 szeryf Wed Nov 13 07:38:57 2002
-apl split//,$F[1];@a=sort map$a[$a++]=$_.$a[$a%=@_],@_ for 1..@_;$a[$F[0]]=~/.$/;$_=$&.$`
91.58 Nicolas Mendoza Sat Nov 16 00:18:04 2002
-pla @o;@f=split//,$F[1];for(@f){@o=sort@o;$r=0;for(@f){$o[$r]=$_.$o[$r];$r++}}$_=$o[$F[0]]
F/\t/ wasn't needed :)
91.59 Alain "TopMach" Dupuis Wed Nov 13 15:28:43 2002
-lp s/.+\t//;for$r(1..length){$p=0;$t[$p++]=~s/^/$_/for/./g;@t=sort@t}$t[$&]=~/.$/;$_=$&.$`
91.60 BigrTex Fri Nov 15 01:08:28 2002
-lp @s=/([,A-Z])/g;for(0..$#s){@r=sort map{$s[$_].$r[$_]}0..$#s}$_=$s[$_].substr$r[$_],0,-1
Decided to play with my solution and see if I could trim off the 2 characters needed to move up in my division... a few things didn't work, but surprisingly, $_ in the last statement appears to still hold STDIN because the for/map scopes have disappeared...
92.59 Scott Hall Wed Nov 13 04:40:27 2002
-lp /^I/;for(1..split//,$'){map{$s[$_]=$_[$_].$s[$_]}0..@_-1;@s=sort@s}$_=$s[$`];$_=(chop).$_
92.60 TilRMan Thu Nov 14 04:40:09 2002
-alp split//,$F[1];for(@_){for$j(0..$#_){s//$_[$j]/for$a[$j]}@a=sort@a}$a[$_]=~/.$/;$_=$&.$`
93.66 Jacco Braat Tue Nov 19 21:23:57 2002
-011 $x=<>;for(@_=sort map"$_"x++$!,@x=split/|\n/,<>){print$x[$x];$x=-1+length$_[$x]}print'
'
94.61 Erik Beatty Tue Nov 19 22:39:00 2002
-an007 @a=sort map{$b[$_].$a[$_]}0..$#b for@b=split"",$F[1];print chop$a[$F[0]],$a[$F[0]],"\n"
Just noticed a better arangement...

My game is golf, perl golf.

94.61 szeryf Wed Nov 13 00:16:24 2002
-anl split//,$F[1];@a=sort+map$a[$a++%@_]=$_.$a[$a%@_],@_ for 1..@_;$a[$F[0]]=~/.$/;print$&.$`
I don't know if I'm beginner or veteran...

If you never played before, you may call yourself a beginner, however good you are

94.63 Martien Verbruggen Fri Nov 15 05:44:27 2002
-lna ($n,$_)=@F;$i=0,@a=sort map$_.$a[$i++],@&for 1..(@&=split'');$a[$n]=~/(.*)(.)/;print$2,$1
95.63 pieman Thu Nov 14 15:02:59 2002
$_=<>;($o,$_)=split;@e=/./g;for(1..@e){@w=sort@w;$w[$_]=~s/^/$e[$_]/for 0..$#e}print$w[$o],"\n"
96.59 Nicolas Mendoza Sat Nov 16 00:09:08 2002
-plaF/\t/ @o;@f=split//,$F[1];for(@f){@o=sort@o;$r=0;for(@f){$o[$r]=$_.$o[$r];$r++}}$_=$o[$F[0]]
or this
96.59 Nicolas Mendoza Sat Nov 16 00:07:30 2002
-plaF/\t/ @o;@f=split//,$F[1];for(@f){@o=sort@o;my$r;for(@f){$o[$r]=$_.$o[$r];$r++}}$_=$o[$F[0]]
maybe this one is better?
96.61 Mike Barton Tue Nov 19 19:25:16 2002
-pa for(@s=split//,$F[1]){$j=0;map{$r[$j++]=$_.$r[$j];}@s;@r=sort@r;}$_=$r[$_];s/(.*)(.)/$2$1\n/
97.60 BigrTex Wed Nov 13 19:45:47 2002
-lp $m=$_;@s=/([,A-Z])/g;for(0..$#s){@g=sort map{$s[$_].$g[$_]}0..$#s}$_=$s[$m].substr$g[$m],0,-1
A couple of tweaks to reduce my tiebreaker -- using $n, @x, and @y were costing me strokes since they don't appear elsewhere in the solution.
97.62 BigrTex Wed Nov 13 19:40:43 2002
-lp $n=$_;@x=/([,A-Z])/g;for(0..$#x){@y=sort map{$x[$_].$y[$_]}0..$#x}$_=$x[$n].substr$y[$n],0,-1
And as I was submitting, I remembered that a scalar that starts with a number evaluates as that number, so I didn't need to regex $_ to get $n, saving 7 strokes and breaking 100.
97.64 pieman Thu Nov 14 12:03:06 2002
$_=<>;($o,$_)=split;@e=/./g;for(1..@e){@w=sort@w;$w[$_]=~s/^/$e[$_]/for(0..$#e)}print $w[$o],"\n"
98.63 Erik Beatty Tue Nov 19 20:52:45 2002
-an007 for(@b=split"",$F[1]){@a=sort map{$b[$_].$a[$_]}(0..$#b)}print chop$a[$F[0]],$a[$F[0]],"\n"
I know I have the extra 0 in the switches, just seemed fitting with the new bond movie coming out this week ;) anyways, I wish I had check the website earlier and had a better start than 3 hrs.. but oh well.. seems like a cool one...

:)

99.59 Scott Hall Wed Nov 13 04:13:51 2002
-lp /^I/;split//,$';for(1..@_){for(0..@_-1){$s[$_]=$_[$_].$s[$_]}@s=sort@s}$_=$s[$`];s/(.*)(.)/$2$1/
99.60 Nicolas Mendoza Fri Nov 15 19:55:31 2002
-pl my@o;/(.*)\t(.*)/;@f=split//,$2;for(@f){@o=sort@o;my$r;for(@f){$o[$r]=$_.$o[$r];$r++}}$_=$o[$1]
I give up

no! never give up!

99.64 Andrew Williams Fri Nov 15 05:04:37 2002
-lnapF\t split//,$F[1];for(@s=("")x@_){$i=0;@s=sort map{$_[$i++].$_}@s}$_=$s[$F[0]];s/(.+)(.)/$2$1/
i'm happy now i've broken 100 :)
99.66 Jacco Braat Tue Nov 19 20:12:07 2002
-011 $x=<>;@s=sort map"$_"x++$!,@i=split//,<>;for(-$#i..0){print$_?$i[$x++]:'
';$x=-1+length$s[$x]}
100.63 Daniel Tuijnman Mon Nov 18 01:34:11 2002
-ln ($i,@f)=split/\s|(?=\D)/;@s=sort map$f[$_].$s[$_],0..$#f for 1..@f;print$f[$i],substr$s[$i],0,-1
100.64 pieman Thu Nov 14 10:28:05 2002
$_=<>;($o,$_)=split;@e=/(.)/g;for(1..@e){@w=sort@w;$w[$_]=~s/^/$e[$_]/ for(0..$#e)}print $w[$o],"\n"
102.59 Joe Baldassini Thu Nov 14 18:47:49 2002
-apl ($i,$_)=@F;@i=split//;for(@i){$l=0;@s=sort map$s[$l++]=$_.$s[$l],@i}($_=$s[$i])=~s/(.*)(.)$/$2$1/
102.63 Daniel Tuijnman Mon Nov 18 01:11:58 2002
-ln ($i,@f)=split /\s|(?=\D)/;@s=sort map{$f[$_].$s[$_]}0..$#f for 1..@f;print$f[$i],substr$s[$i],0,-1
102.63 Daniel Tuijnman Mon Nov 18 01:11:28 2002
-ln ($i,@f)=split /\s|(?=\D)/;@s=sort map{$f[$_].$s[$_]}0..$#f for 1..@f;print$f[$i],substr$s[$i],0,-1
103.60 Frantisek Darena Thu Nov 14 10:31:57 2002
-pa ($n,$_)=@F;@b=sort@a=/./g;for$r(2..@a){$i=0;$_=$a[$i++].$_ for@b;@b=sort@b}$b[$n]=~/.$/;$_="$&$`\n"
103.61 Nicolas Mendoza Fri Nov 15 19:06:43 2002
-p my@o;/(.*)\t(.*)/;@f=split//,$2;for(@f){@o=sort@o;$r=0;for(@f){$o[$r]=$_.$o[$r];$r++}}$_="$o[$1]\n";
Even more improvements on my first contrib
104.64 BigrTex Wed Nov 13 19:39:26 2002
-lp ($n)=/(\d+)/;@x=/([,A-Z])/g;for(0..$#x){@y=sort map{$x[$_].$y[$_]}0..$#x}$_=$x[$n].substr$y[$n],0,-1
I knew that there must be a 'good' way to use a single map, but I wanted to get the 114 in, so I used a double for instead of the double map. Here, I've figured out how to use the inner map to create the array to sort.
105.59 Scott Hall Wed Nov 13 04:12:59 2002
-lp /       /;split//,$';for(1..@_){for(0..@_-1){$s[$_]=$_[$_].$s[$_]}@s=sort@s}$_=$s[$`];s/(.*)(.)/$2$1/
105.63 Martien Verbruggen Fri Nov 15 05:18:08 2002
-lna ($n,$_)=@F;$i=0,@a=sort map$_.$a[$i++],split''until length$a[0]==length;$a[$n]=~/(.*)(.)/;print$2,$1
106.61 Frantisek Darena Thu Nov 14 08:28:56 2002
-pa ($n,$_)=@F;@b=sort@a=/./g;for$r(2..@a){$i=0;$_=$a[$i++].$_ for@b;@b=sort@b}$_=$b[$n];s/(.*)(.)/$2$1\n/
107.60 Mike Barton Tue Nov 19 16:07:46 2002
-p /(\S+)$/;@s=split(//,$1);for(@s){$j=0;for(@s){$r[$j++]=$_.$r[$j];}@r=sort@r;}$_=$r[$_];s/(.*)(.)/$2$1\n/
Why does map{}@s use so much more memory than for(@s){}?

nested maps don't allow garbage collector to work and thus they use too much memory (>700M) on the 28th test.

107.64 Andrew Williams Fri Nov 15 04:30:30 2002
-lnaF\t ($o,$_)=@F;@c=split//;for(@s=("")x@c){$i=0;@s=sort map{$c[$i++].$_}@s}$s[$o]=~/(.+)(.)/;print"$2$1"
108.60 Nicolas Mendoza Fri Nov 15 18:02:55 2002
-p my@o;/(.*)\t(.*)/;@f=split//,$2;for(@f){@o=sort@o;$r=0;for(@f){$o[$r]=$f[$r].$o[$r];$r++;}}$_="$o[$1]\n";
Some small improvements on my first contrib
108.65 Mark Hillebrand Thu Nov 14 10:11:07 2002
-lp ($j,$k,@A)=m/\d+|./g;@R=map/\d+/g,sort map{sprintf"$_%3d",$i++}@A;for(0..$#A){$o.=$A[$j],$j=$R[$j]}$_=$o
Squeezed some air out of the previous solution.

good, air is needless in golf.

109.61 Thomas Bätzler Thu Nov 14 12:13:14 2002
-na $j=$_;@f=sort{$a->[0]cmp$b->[0]}@l=map{[$_,$i++]}split//,$F[1];map{print$l[$j][0];$j=$f[$j][1]}@l;print$/
Some more strokes whittled away, still a long way to go *sigh*

good, good.

113.61 TilRMan Thu Nov 14 03:35:07 2002
-nl s/(\d+)\t//;$k=$1;@s=split//;for(@s){for$j(0..$#s){$a[$j]=$s[$j].$a[$j]}@a=sort@a}s/.$//,print"$&$_"for$a[$k]
This is my first submission to TPR, but I like to think of myself as a Perl veteran. :-)
114.60 Nicolas Mendoza Fri Nov 15 17:52:56 2002
-n @f=@o='';/(.*)\t(.*)/;@f=split//,$2;for(@f){@o=sort@o;$r=0;for(@f){$o[$r]=$f[$r].$o[$r];$r++;}}print"$o[$1]\n";
My first perlgolf-submission, I hope it works, the test program said so.
114.62 BigrTex Wed Nov 13 18:09:53 2002
-lp ($n)=/(\d+)/;@x=/([A-Z,])/g;for(0..$#x){for(0..$#x){$y[$_]=$x[$_].$y[$_]}@y=sort@y}$_=$x[$n].substr$y[$n],0,-1
Fine... a 114 with the double map replaced with a double for. Runs a lot faster now too. I'll review map before I put one back in to see if there would be some useful way to use map, besides trimming strokes.

Looks good. Notice that map isn't forbidden, just using insanely much memory (more than 700M for the double map solutions)

114.62 Jason Carter Wed Nov 13 22:15:07 2002
-lna split//,$F[1];@o=sort@_;for(2..@_){$o=0;for(@o){s/.*/$_[$o++]$&/;}@o=sort@o;}for($o[$F[0]]){/.$/;print$&,$`;}
116.63 Jacco Braat Wed Nov 13 13:32:47 2002
($x,$_)=split/\n|\t/,<>;$y=999;@s=map{s/.1//;$_}sort map$_.++$y,@i=split//;for(0..$#s){print$i[$x];$x=$s[$x]}print$/
117.65 Martien Verbruggen Fri Nov 15 04:43:20 2002
-lna ($n,$_)=@F;$"="";@s=map{/(\d+)/}sort map{sprintf"$_%099d",$i++}@u=split'';$n=$s[$n]while@u>push@p,$u[$n];print@p
118.68 Mark Hillebrand Thu Nov 14 07:57:25 2002
-ln ($j,$k,@A)=m/\d+|./g;@R=map/\d+/g,sort map{sprintf "$_%03d",$i++}@A;while($#I<$#A){push@I,$j;$j=$R[$j]}print@A[@I]
First try and still a looong way to go.

Nice try!

119.60 Jason Carter Wed Nov 13 21:41:48 2002
-lna ($s,$_)=@F;@s=split//;@o=sort@s;for(2..@s){$o=0;for(@o){s/.*/$s[$o++]$&/;}@o=sort@o;}for($o[$s]){/.$/;print$&,$`;}
119.62 Thomas Bätzler Thu Nov 14 11:25:02 2002
-na $j=$F[0];@f=sort{$a->[0]cmp$b->[0]}@l=map{[$_,$i++]}split//,$F[1];for(@l){print$l[$j]->[0];$j=$f[$j]->[1];}print$/;
Different Algorithm, still not even close ;-(

Apply some craft then :)

119.63 Frantisek Darena Wed Nov 13 14:34:08 2002
-pa chop;($n,$_)=@F;@b=sort@a=/./g;chop;while(chop){$i=0;for(@b){$_=$a[$i++].$_;}@b=sort@b;}$_=$b[$n];s/(.*)(.)/$2$1\n/
122.64 Andrew Williams Fri Nov 15 02:07:33 2002
($o,$_)=split/\t/,<>;chomp;@s=sort(@c=split//);for(1..$#c){$i=0;@s=sort map{$c[$i++].$_}@s}$s[$o]=~/(.+)(.)/;print"$2$1\n"
123.63 Martien Verbruggen Fri Nov 15 04:26:58 2002
-lna ($n,$_)=@F; $"="";@s=map$_->[1],sort{$a->[0]cmp$b->[0]}map[$_,$i++],@u=split'';$n=$s[$n]while@u>push@p,$u[$n];print@p;
123.63 Daniel Tuijnman Sun Nov 17 17:20:34 2002
-ln ($i,@l)=split/\s|(?=\D)/;for$j(0..$#l){splice@t,+(grep{$l[$j]ge$_}@l[0..$j-1]),0,$j}print$l[$i],map{$l[$i=$t[$i]]}2..@l
126.61 Paul van Eldijk Sun Nov 17 01:01:43 2002
($i,$_)=split" ",<>;%i=map{$j++,$_}split//;@s=sort{$i{$a}cmp$i{$b}||$a<=>$b}keys%i;for(1..@s){print$i{$i};$i=$s[$i]};print"\n"
130.61 IainT Fri Nov 15 11:01:19 2002
-ln ($t,$s)=/(\d+)\t(.*)/;@x=0..(length$s)-1;for(@x){$t[$_]=substr($s,$_,1).$t[$_]for(@x);@t=sort@t}$_=$t[$t];print/(.)$/,/(.*).$/
130.62 BigrTex Wed Nov 13 08:44:57 2002
-lp ($n,$_)=/(\d*)\t(.*)/;$l=length;@x=/(.)/g;for(0..--$l){for(0..$l){$y[$_]=$x[$_].$y[$_]}@y=sort@y}$_=$x[$n].substr($y[$n],0,-1)
-p flag.. means I can drop a <> and a print, also used $_ instead of $s to reduce strokes up front.
130.62 Paul van Eldijk Fri Nov 15 00:24:29 2002
($i,$_)=split/\t|\n/,<>;%i=map{$j++,$_}split//;@s=sort{$i{$a}cmp$i{$b}||$a<=>$b}keys%i;for(1..@s){print$i{$i};$i=$s[$i]};print"\n"
131.63 Paul van Eldijk Wed Nov 13 13:08:40 2002
($i,$_)=split/\t|\n/,<>;@a=split//;for(0..$#a){$r[$_]=$a[$_].$r[$_]for(0..$#a);@r=sort@r}print+(split(//,$r[$i]))[-1,0..$#a-1],"\n"
131.64 Thomas Bätzler Wed Nov 13 14:56:31 2002
-pal @i=split//,$F[1];sub t{($a,@j)=@_;return sort map{$_.=shift@$a}@j;}for(@i){@t=t(\@t,@i)}$i=$t[$F[0]];$_=substr($i,-1,1,"").$i;
132.61 IainT Wed Nov 13 16:49:12 2002
-ln ($t,$s)=/(\d+)\t(.*)/;@x=0..(length$s)-1;
for(@x){$t[$_]=substr($s,$_,1).$t[$_]for(@x);@t=sort@t}
$_=$t[$t];print/(.)$/,/(.*).$/
OK that'll do on that one for now. Will think more about it later.
140.61 IainT Wed Nov 13 16:08:21 2002
-ln ($t,$s)=/(\d+)\t(.*)/;@x=0..(length$s)-1;
for(@x){$t[$_]=substr($s,$_,1).$t[$_]for(@x);@t=sort@t}
$r=$t[$t];print$r=~/(.)$/,$r=~/(.*).$/
OK, 30 minutes' golfing is starting to show some improvement

main improvements came after 30 years :)

141.63 BigrTex Wed Nov 13 08:36:50 2002
-l ($n,$s)=<>=~/(\d*)\t(.*)/;$l=length$s;@x=$s=~/(.)/g;for(0..--$l){for(0..$l){$y[$_]=$x[$_].$y[$_]}@y=sort@y}print$x[$n].substr($y[$n],0,-1)
I disliked how I was forming @x with a for loop. The regex is better, but still too long. Also removed a ' ' and a ';'

hmm, very well motion, go on :)

153.64 Thomas Bätzler Wed Nov 13 14:41:01 2002
-pal @i=split//,$F[1];@z=sort@i;sub z{($a,@j)=@_;return sort map {$_.= shift @$a}@j;}for($i=@i;--$i;){@z=z(\@z,@i)}$i=$z[$F[0]];$_=substr($i,-1,1,"").$i;
Squeezed the code a bit.
159.62 IainT Thu Nov 14 13:07:59 2002
-nl ($p,$t)=/(\d+)\t(.*)/;for(@s=sort@o=split//,$t){$a.=$o[$p];$x=$s[$p];$n=1;
$n++while$s[--$p]eq$x&&$p>=0;$p=0;for(@o){$n--if$_
eq$x;last
if!$n;$p++}}print$a
163.62 BigrTex Wed Nov 13 06:39:04 2002
-l ($n,$s)=<>=~/(\d*)\t(.*)/;$l=length$s;for(0..--$l){$x[$_]=substr($s,$_,1)}for(0..$l){for(0..$l){$y[$_]=$x[$_].$y[$_]}@y=sort@y}print $x[$n].substr($y[$n],0,-1);

Wow, it's been a while since I had the time to submit a solution. Thanks for the algorithm.
185.65 Jason Purdy Tue Nov 19 21:40:36 2002
-l ($n,$e)=(<STDIN>=~/(.+)\t(.+)\n\z/);@o=split'',$e;@m=sort split'',$e;while(++$w<@m){for($i=0;$i<@m;$i++){$m[$i]=$o[$i].$m[$i];}@m=sort@m;}$m[$n]=~s/(.+)([A-Z,]{1})/$2$1/;print$m[$n];
Works well. Still lots of seconds for improvements (well, about 3600)
186.61 IainT Thu Nov 14 12:51:18 2002
-nl ($p,$t)=/(\d+)\t(.*)/;
@o=split//,$t;
@s=sort@o;
for(@o){
$a.=$o[$p];
$x=$s[$p];
$n=1;$q=$p;
$n++while$s[--$q]eq$x&&$q>=0;
$i=0;
for(@o){$n--if$_ eq$x;
last if!$n;$i++}
$p=$i}print$a
Hmmm still got a long way to go
196.62 IainT Wed Nov 13 15:45:59 2002
$_=<>;($t,$s)=/(\d+)\t(.*)/;
$l=(length$s)-1;@t[0..$l]=(''x$l);
for(0..$l){
for$j(0..$l){
$t[$j]=substr($s,$j,1).$t[$j]}
@t=sort{$a cmp$b}@t}
$r=$t[$t];
print$r =~ /(.)$/,$r =~ /(.*).$/;print"\n";
OK so it's way off the mark, but at least it's a start. Uses algorithm 2 from the course spec, will probably look for a better one as the course progresses!

hmm, well, are you sure you squeeze everything from this algorithm?

199.63 Mike Barton Mon Nov 18 22:24:45 2002
$i=<STDIN>;$i=~s/(\d+)\s+(.*)/\1/;@s=split(//,$2);@t=
sort(@s);for(1..@s){$l=0;for(0..$i){if($s[$_]eq$s[$i]
){$l++;}}for(0..@s){if($t[$_]eq$s[$i]){if(!--$l){$i=
$_;break;}}}$r=$s[$i].$r;}print"$r\n";
218.63 Mike Barton Mon Nov 18 22:16:37 2002
$l=<STDIN>;$l=~/(\d+)\s+(.*)/;$i = $1;@s=split(//,$2);
@t=sort(@s);for(1..int(@s)){$l=0;for(0..$i){if($s[$_]
eq$s[$i]){$l++;}}for(0..int(@s)){if ($t[$_]eq$s[$i])
{$l--;if(!$l){$i= $_;break;}}}$r=$s[$i].$r;}print"$r\n";
284.51 IainT Thu Nov 14 11:40:03 2002
-n ($p, $trans) = /(\d+)\t(.*)/;

@o = split //, $trans;
@s = sort @o;

for (@o) {
  print $o[$p];
  $next = $s[$p];
  $n=1; $p2 = $p;
  $n++ while ( $s[--$p2] eq $next && $p2>=0 );
  $i=0;
  for (@o) {
    $n-- if $_ eq $next;
    last unless $n;
    $i++;
  }
  $p = $i;
}
print "\n";
OK this one uses algorithm 1 -- time to start golfing this, then i've got two algorithms to play with :)

mmm, internal id of this solution is 5000. well, congradulations! good sign that it's accepted :)

298.59 Thomas Bätzler Wed Nov 13 14:05:03 2002
$index = <>;
$index =~ s/\t(.*)//;

@input = split //,$1;

@sorted = sort @input;

sub merge {
  ($a,@i)=@_;
  return sort map { $_ .= shift @$a } @i;
}

for( my $i = 1; $i < @input; $i++ ){
  @sorted  = merge (\@sorted, @input);
}

$input = $sorted[$index];

print substr( $input,-1,1,"" ), $input,"\n";
Lots of room for improvement ;-)

indeed :)

315.59 Amir Karger Thu Nov 14 18:49:22 2002
-wlp use strict;

# puts number in $`, word in $'
/\t/; 
my ($len, @letter) = ($`, split//, $');

# Algorithm 2: Sort N times, prefix N-1 times
my $c;
my @y = sort @letter;
for (1..$#y) {
    $c=0, @y=sort map{$letter[$c++] . $_} @y;
}

# Take  given row, move letter at end to the front
$_= $y[$len];
s/(.*)(.)/$2$1/;
use strict, -w, commented version. Algorithm 2

for the golf? :)

656.56 Amir Karger Fri Nov 15 17:39:24 2002
-wpal use strict;
$_=pop@F;
# Array of unsorted letters
my @u=/./g;
my (%v, $c);
# Store the position in the string of the first A, the second A, etc.
# Key = 'A' for first A in @u, 'AA' for second A, Value = position in @u
my %w=map {$_ x ++$v{$_}, $c++} @u;
# Sneaky. Just sorting keys gives you the order the keys would have if
# we sorted @u, i.e., the sorted string.
my @s=sort keys %w;
my $p=$F[0];
my $x;
for(1..@u) {
    # take p'th letter from unsorted string
    my $l = $u[$p];
    $x.=$l;
    # $s[$p] = letter at that position in the sorted string
    # $w{} tells you the position of $s[$p] in the unsorted string!
    $p=$w{$s[$p]};
}
$_=$x;
I'm getting sick of Algorithm 2. Let's try algorithm 1. use strict & -w to start with, as usual.

It runs very fast at least

Artistic/Unorthodox

ScoreGolferSubmit TimeCode
88.59 Bass Tue Nov 19 15:17:08 2002
-pl for$f(sort{$s[$i++]=$a
cmp$b}@c=/[;-o,]/g){$o.=$c[$_];$i=0;@c=sort{$s[$i++]}@c}$_=$o
strange sort subroutines are my favourite
131.55 Benoît Chauvet Thu Nov 14 10:02:38 2002
-lp s/.*^I//;$==$&;@==sort@@=/./g;$_=join'',map{$_=$l;$l=$$l;/./;$&}map{${$:=$_.${$_}}=$;.push@{$;=shift@=},${$_}++;$l=$=--?$l:$:}@@
I don't know if it's worth the unorthodox category... What can I say ? It's dirty, but it works. :)

very nice, but looks like just optimized for tie not truly ortodox :)

136.56 Terje K Mon Nov 18 15:53:54 2002
-pl $i=$_;
$p[$x++]=$c{$_}++for@i=/\pL|,/g;
$c{$_}=$s+0+!($s+=$c{$_})for",",A..Z;
$o=$i[$i].$o,$i=$p[$i]+$c{$i[$i]}for@i;
$_=chop($o).$o
the one without sort .. didnt bother to golf it to death

Rejected

ScoreGolferSubmit TimeCode
3.18 Jeff Moore Tue Nov 19 22:57:19 2002
#!perl -l
Just to warn you that the top players have tiebreaker 54.559, you have 54.563

your tie: 54.563 rick, Stephen: 54.559

54.55 BoB (Best of Breed - referees) Fri Nov 15 16:15:42 2002
-lp /\D/g;@==sort@$=map$_.shift@=,@@for@@=//;$_=@$[$_]
Optimize the tiebreaker a bit

Works on older perls, but not on 5.8

55.55 Jasper McCrea Tue Nov 19 01:13:03 2002
-lp @==sort@$=map$_.shift@=,@@for@@=/[,@-o]/g;$_=$$[$_]
sorry for submitting all this for 0.001 lousy point

sorry, fails in 5.8 :( Hole 'bwt' jasper-mccrea-55-2: Running test 1 ... Unexpected STDOUT: Expected: AB but got:

55.55 Jasper McCrea Tue Nov 19 01:09:13 2002
-lp @==sort@$=map$_.shift@=,@@for@@=/[,@-a]/g;$_=$$[$_]
I expect the other 55.55's are actually this (?)

sorry, fails in 5.8 :( Hole 'bwt' jasper-mccrea-55-2: Running test 1 ... Unexpected STDOUT: Expected: AB but got:

55.55 Jasper McCrea Tue Nov 19 01:06:07 2002
-lp @==sort@$=map$_.shift@=,@@for@@=/[,@-Z]/g;$_=$$[$_]
Finally! Now to work out what a 54 looks like.

Doesn't work on 5.8.0 The fact that @- does not get interpolated is a 5.6 bug, and it's fixed now...

58.59 Jeff Moore Mon Nov 18 01:51:57 2002
-lp @s=sort@p=map$_.shift@s,@o for@o=/[@-p,]/g;$_=@p[$_+0]
Hole 'bwt' bwt.pl: Running test 1 ... Unexpected STDOUT: Expected: AB but got: 5.6.1 has a bug where @- is not interpolated. it bites here. your solution will not work on 5.8.0
61.56 Michael Wrenn Tue Nov 19 19:18:04 2002
-lp @@=map$_.(sort@@)[$@++%@+],@+for@+=/\D/g;$_=@@[++$_];chop
Minor tie-break change (@= --> @+) to thwart a late effort by a Top 10 desiree! I hope they are all out of ammo!

"Modification of a read-only value" on both 5.8.0 and 5.6.1, what perl do you use?

63.52 Chris Dolan Tue Nov 19 07:42:23 2002
-pl @_=sort@==map@@[$_].@_[$_],-@@..-1for@@=/[,@-_]/g;$_=@=[$_]
It's pathetic, really, that I'd waste your time submitting a solution with a 0.006 gain, but it's me or Amir, you see, and I spent an hour getting it...

doesn't work, @- inside of regex interpolates in 5.8.0

63.54 Terje K Fri Nov 15 15:38:36 2002
-pl /^I/;$$=0,@$=map$_.(sort@$)[$$++],@=for@==$'=~/./g;$_=$$[$_]
Hole 'bwt' bwt.pl: Running test 1 ... Unexpected STDERR: Expected: but got: Modification of a read-only value attempted at bwt.2581 line 2, <> line 1. $$ is not assignable in 5.8
66.58 Michael Rybakin Thu Nov 14 09:52:00 2002
-lp map{@m=sort@m;$p=0;@m=map$_.$m[$p++],@A}@A=/[A-Z,]/g;$_=$m[$_]
nested maps don't allow garbage collector to work and thus they use too much memory (>700M) on the 28th test. sorry, rejected by the 12th article of the rules.
67.58 Joe Baldassini Fri Nov 15 21:41:38 2002
-apl @s=@f=split//,pop@F;for(2..@s){$s=0;s/^/$f[$s++]/for@s=sort@s}
Hole 'bwt' joe-baldassini-67: Running test 1 ... Unexpected STDOUT: Expected: AB but got: 1 BA
73.60 Michael Wrenn Thu Nov 14 22:33:05 2002
-lp map{$i=0;@s=map$_=$_[$i++].$_,sort@s}2..(@s=@_=(/[A-Z,]/g));$_=$s[$_]
This one takes a really long time! I hope it will pass ...

It's not the time that is the problem, it's the memory usage. >700M while the rules guarantee you only a few tens of megs

73.63 Qingning Huo Fri Nov 15 11:01:13 2002
-pl s/\d+.//;map{map$_=$x[$i++%@x].$_,sort@y}@x=@y=split//;$_=$y[$&];chop
nested maps don't allow garbage collector to work and thus they use too much memory (>700M), sorry rejected by the 12th article of the rules.
76.57 pom Thu Nov 14 01:13:27 2002
-pl /       /;@s=sort map$_.shift@s,@;for@;=split//,$';$s[$`]=~/.$/;$_=$&.$`
About an hour worth of golfing... don't know how much more time I will be able to put into this. On the other hand, the 19th is my birthday, and if all goes well I'll also be a doctor by then, so a good position on the leaderboard will be the icing on the cake! Thanks for the refereese as always -- this is a straight implementation of the second algorithm given in the rules.
78.55 Paul van Eldijk Tue Nov 19 14:49:18 2002
-alp split//,$F[1];@$=@_;$$=0,@$=map$_[$$++].$_,sort@$ for(2..@$);$_=$$[$F[0]]
$$ is not assignable in 5.8.0
78.62 Benoît Chauvet Wed Nov 13 14:20:14 2002
-lpa s/.*^I//;map{@c=@a;@b=map{(shift@c).$_}sort@b}@b=@a=split//;$_=$b[$&];chop
it uses too much memory on test 28 (crashes above 400M). sorry, rejected by 12th article of generic rules.
80.60 Bass Mon Nov 18 16:09:09 2002
-pl map{$#A=$#Z;@A=sort map$Z[$Z++%@Z].$_,@A}@Z=/[A-Z,]/g;$_=$A[$_];$_=chop().$_
I really didn't have time for golf this month, glad you did.

nested maps don't allow garbage collector to work and thus they use too much memory (>700M) on the 28th test. sorry, rejected by the 12th article of the rules.

80.61 Terje K Wed Nov 13 21:50:13 2002
-pl /^I/;$f=0,@f=sort map$_.$f[$f++],@;for(1)x(@;=$'=~/./g);$_=chop($_=$f[$`]).$_
Hole 'bwt' bwt.pl: Running test 1 ... Unexpected STDOUT: Expected: AB but got: BA
81.60 Bass Tue Nov 19 09:46:55 2002
-pl @g=/[@-g,]/g;@;=sort map$g[$i++%@;].$_,@;for@;=('')x@g;$_=$;[$_];$_=chop().$_
maybe a little less aggressive memory usage would get me out of the sand trap..

works in 5.6.1, but sorry, "@-" does interpolate in 5.8.0, so [@-g,] is probably not what you want.

83.58 Alain "TopMach" Dupuis Tue Nov 19 20:25:39 2002
-lpa for(@o=/[@-o,]/g){$r[$r++%@o]=~s/^/$_/for@o;@r=sort@r}$r[$F[0]]=~/.$/;$_=$&.$`
works in 5.6.1, but doesn't in 5.8.0 because @- interpolate.
83.58 Alain "TopMach" Dupuis Tue Nov 19 05:22:41 2002
-lpa for(@r=/[@-o,]/g){$o[$o++%@r]=~s@^@$_@for@r;@o=sort@o}$o[$F[0]]=~/.$/;$_=$&.$`
Fails in 5.8. @- is does get interpolated in 5.8, but it wasn't in 5.6 which was a bug.
83.63 Daniel Tuijnman Mon Nov 18 02:16:52 2002
-lp ($i,@f)=split/\s|(?=\D)/;$_=(map{@s=map$f[$_].(sort@s)[$_],0..$#f}1..@f)[$i-@f]
Uses too much mermory (> 700M). the rules only guarantee you a few tens of megs
86.59 Terje K Wed Nov 13 21:49:16 2002
-pl /       /;$f=0,@f=sort map$_.$f[$f++],@;for(1)x(@;=$'=~/./g);$_=chop($_=$f[$`]).$_
tabpo
88.00 Nicolas Mendoza Mon Nov 18 23:55:05 2002
-ln tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
Very good tiebreaker. Very bad code.
88.57 TilRMan Thu Nov 14 05:16:19 2002
-alp split//,$F[1];for(@_){$a[$_]=$_[$_].$a[$_]for0..$#_;@a=sort@a}$a[$_]=~/.$/;$_=$&.$`
Compilation errors. Please check your submission.
114.63 BigrTex Wed Nov 13 17:37:51 2002
-lp ($n)=/(\d+)/;@x=/([A-Z,])/g;map{map{$y[$_]=$x[$_].$y[$_]}0..$#x;@y=sort@y}0..$#x;$_=$x[$n].substr($y[$n],0,-1)
I'm going to have to reboot my computer. I stopped the test script in the middle of test 28 a couple of times in approaching this solution [the parens around the first $n gave me trouble], and now it bombs out on that test, but I'm convinced that it shouldn't take any more memory than it was taking this morning/last night.

If you are referring to your other double mapper, that will get rejected too. Uses way too much memory, the rules only guarantee you a few tens of megabytes (referee interpretation of rule 12)

118.59 Paul van Eldijk Mon Nov 18 23:23:34 2002
-alp ($i,$_)=@F;%i=map{$j++,$_}split//;@s=sort{$i{$a}cmp$i{$b}||$a<=>$b}keys%i;$_='';for$j(1..@s){$_.=$i{$i};$i=$s[$i]
Missing square bracket
119.62 Mike Barton Tue Nov 19 02:26:05 2002
-n /(\S+)$/;@s=split(//,$1);map{for(0..(@s-1)){$r[$_]=$s[$_].$r[$_];}@r=sort(@r);}@s;$r[$_]=~s/(.*)(.)/print"$2$1\n"/e;
Too much memory. it crashed my system once :(
122.63 Paul van Eldijk Wed Nov 13 15:44:48 2002
($i,$_)=split/\t|\n/,<>;$h{$j++}=$_ for split//;@_=sort{$h{$a}cmp$h{$b}}keys%h;for(1..@_){print$h{$i};$i=$_[$i]};print"\n"
with perl 5.8.0 it fails on test 4 - Expected: DRDOBBS but got: DRDOBSD with perl 5.6.1 it fails on test 18 - Expected: AAABBBCCC but got: AAAAAAAAA what perl do you use?
123.62 IainT Mon Nov 18 14:53:07 2002
-lnaF\t $t=pop@F;@x=0..(length$t)-1;
map{$t[$_]=substr($t,$_,1).$t[$_]for@x;@t=sort@t}@x;
$_=$t[pop@F];print/(.)$/,/(.*).$/
Hmm I can actually make this a stroke shorter by using a real tab rather than the \t in the switches. Shame I can't find out how to copy & paste that though! Next on the golfing list: find out how to shorten those length() and substr() expressions ...

same reason

127.63 BigrTex Wed Nov 13 08:51:14 2002
-lp ($n,$_)=/(\d+)^I(.+)/;$l=length;@x=/(.)/g;map{map{$y[$_]=$x[$_].$y[$_]}0..$l;@y=sort@y}0..--$l;$_=$x[$n].substr($y[$n],0,-1)
for -> map, 2 strokes \t -> literal tab, 1 stroke getting to sleep tonight, priceless...

out of memory

129.62 IainT Mon Nov 18 14:21:37 2002
-lnaF\t $s=pop@F;$t=pop@F;@x=0..(length$s)-1;
map{$t[$_]=substr($s,$_,1).$t[$_]for@x;@t=sort@t}@x;
$_=$t[$t];print/(.)$/,/(.*).$/
Pondering some new ideas, I'll see if they go anywhere

uses too much memory on test 28.

136.62 Mike Barton Tue Nov 19 00:55:52 2002
-p /(\d+)\t+(.*)/;$i=$1;@s=split //,$2;for(0..@s)
{for(0..@s){$r[$_]=$s[$_].$r[$_];}@r=sort(@r);}
$r[$i++]=~s/(.{$i})(.*)/$_="$2$1\n"/e;
I don't see how you people do this...

I'm still getting: Hole 'bwt' bwt.pl: Running test 1 ... Unexpected STDOUT: Expected: AB but got: 1 BA If the solutions survive the test program for you, try with file upload

167.63 Mike Barton Mon Nov 18 23:02:57 2002
$i=<STDIN>;$i=~s/(\d+)\t+(.*)/\1/;@s=split(//,$2);
for(0..@s){for(0..@s){$r[$_]=$s[$_].$r[$_]};@r=
sort(@r);}print(substr($r[$i],$i+1,@s).substr(
$r[$i],0,$i+1)."\n");
Hole 'bwt' bwt.pl: Running test 1 ... Unexpected STDOUT: Expected: AB but got: B