fork(1) download
  1. import Data.Function (on)
  2. import Data.List (sortBy)
  3.  
  4. n561 :: String -> [(Int, [String])]
  5. n561
  6. = sortBy (compare `on` snd)
  7. . zip [1..]
  8. . drop 1
  9.  
  10. main :: IO ()
  11. main = getContents >>= mapM_ print . fmap id . n561
Success #stdin #stdout 0s 8388607KB
stdin
10
4 2 2 2 2 2
1 2 2
1 3 2
1 2 3
3 2 2 2 2
2 2 2 2
1 3 3
3 3 3 3 3
2 4 3 3
2 2 3 4
stdout
(2,["1","2","2"])
(4,["1","2","3"])
(3,["1","3","2"])
(7,["1","3","3"])
(6,["2","2","2","2"])
(10,["2","2","3","4"])
(9,["2","4","3","3"])
(5,["3","2","2","2","2"])
(8,["3","3","3","3","3"])
(1,["4","2","2","2","2","2"])