|Submit||All submissions||Best solutions||Back to list|
SLEXSORT - Lexicographic sort
Given alphabet A and a list of words, sort the list according to the lexicographic order induced by A.
The first line of input contains t, the number of tests.
Each test begins with a line with alphabet A, which consists of lowercase letters arbitrary chosen from the Latin alphabet. The next line contains an integer n<100 000 - the number of words. The subsequent n contain one word each, which is not longer than 1 000 letters. Additionally, you can assume that the total number of letters in all words of each test does not exceed 4*106.
There is an empty line after each test.
For each test output the sorted list of words in successive lines.
The score is equal to the length of the source code of your program.
Input: 2 re 3 ere rer re balujemy 5 bel luba lej bal leje Output: re rer ere bal bel luba lej lejeWarning: large Input/Output data, be careful with certain languages
|Cluster:||Cube (Intel G860)|
|Languages:||All except: ERL JS-RHINO NODEJS PERL6 SCM qobi VB.NET|
2012-12-27 12:03:51 Aditya Pande
submission ID 8356382 giving TLE in RUBY
i got AC in C++ in 1.2 seconds
2012-03-18 16:47:45 Hallvard Norheim Bø
Can there be duplicate words in a test set? Or are all words distinct?
2011-09-23 11:32:54 HWK
@Piotr Kakol: What's wrong with this task? Everytime 'Internal Error' even on old AC-solutions. :-(
Edit: Seems that SPOJ has solved the problem.
Last edit: 2011-09-23 11:51:58
2010-11-08 20:40:52 Piotr KÄ…kol
You would have to ask the author because I have access only to my tasks so I'm not able to look up Your code. Sorry.
Last edit: 2011-01-04 19:41:13
2010-11-04 16:04:35 Piotr Fusik
For what input does my #4256038 fail ? Thanks.
2010-07-02 13:40:57 Piotr KÄ…kol
Impossible is nothing. :-)
2010-06-30 18:37:59 Zoltán Zámbori
No, the shortest length is 71 (in Perl). :-)
2010-04-26 14:09:59 Piotr KÄ…kol
You can also submit here Your solutions.
// Shortest length is 73 (in Perl). ;-)
Last edit: 2010-05-03 17:51:44