結果
| 問題 | No.205 マージして辞書順最小 |
| コンテスト | |
| ユーザー |
aimy
|
| 提出日時 | 2017-06-17 10:54:07 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 5,000 ms |
| コード長 | 360 bytes |
| コンパイル時間 | 3,120 ms |
| コンパイル使用メモリ | 180,792 KB |
| 実行使用メモリ | 8,064 KB |
| 最終ジャッジ日時 | 2024-10-01 09:28:24 |
| 合計ジャッジ時間 | 4,022 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import qualified Data.ByteString.Char8 as B
import Data.List
wd = '|'
main = do
getLine
bs <- map (flip B.snoc wd) . B.lines <$> B.getContents
putStrLn (merge bs)
merge bs = reverse $ fst $ until (null . snd) conc ("", sort bs)
conc (r,(b:bs)) = (c:r, sort (filter notNull (b':bs)))
where
(Just (c,b')) = B.uncons b
notNull = not . (== wd) . B.head
aimy