|Submit||All submissions||Best solutions||Back to list|
NEXTPERM - Next permutation
|Wersja polska||English version|
Given string n, your task is to print next permutation of string n.
The first line of the standard input contains one integer t (t<101) which is the number of test cases.
In each of the next t lines there is one integer l (l<20) which is length of string n. Line below you will be given string n.
For each string n, print the next permutation of string n or ERROR if there is no such a permutation.
|Added by:||Piotr Ką kol|
|Cluster:||Cube (Intel G860)|
|Languages:||All except: SCM qobi|
2013-11-03 15:18:29 Piotr KÄ…kol
Thanks for the info! I'll fix it along with LOOK_SAY.
Edit: Fixed and rejudged.
Last edit: 2013-12-07 00:20:24
2013-11-02 22:20:09 Mitch Schwartz
Test cases are weak; my submission 10406350 doesn't handle cases like cfedba properly but still passed.
Last edit: 2013-11-02 23:03:16
2012-09-01 19:12:04 Piotr KÄ…kol
@Avinash - Your answer for:
2012-09-01 13:11:07 AVINASH JAIN
Its giving wrong answer again and again. My program is running for the test cases given and for some random test cases. Please give some more test cases. Can n be zero(0).
2010-02-19 22:50:13 Piotr KÄ…kol
1) length < 20
2) Yes. For example succesive permutations of length 3 are:
Then You should print ERROR.
3) Yes, only lowercase (but ERROR is made of uppercase letters).
4) No, they can't.
5) Good luck. ;-)
2010-02-19 14:39:59 Alessandro Ferreira - UFMS
What's the limit for 'l'?
My task is to find the next permutation in lexicographic ordering ?
Does the string contain only lowercase letters? May appear repeated elements in string?
Last edit: 2010-02-19 18:33:11