結果
問題 | No.592 括弧の対応 (2) |
ユーザー |
|
提出日時 | 2017-11-11 18:08:12 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 317 ms / 5,000 ms |
コード長 | 347 bytes |
コンパイル時間 | 1,641 ms |
コンパイル使用メモリ | 173,696 KB |
実行使用メモリ | 49,408 KB |
最終ジャッジ日時 | 2024-11-24 19:20:17 |
合計ジャッジ時間 | 3,326 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
コンパイルメッセージ
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
ソースコード
importData.ListimportControl.Monadmain = getLine >> getLine >>= mapM_ print . solvesolve::String->Intsolve = map snd . sort . snd . foldl' f ([], []) . zip [1..]wheref::IntIntInt->IntChar->IntIntIntf (xs, ans) (i, '(') = (i:xs, ans)f (x:xs, ans) (i, ')') = (xs, (x, i):(i, x):ans)