結果
| 問題 |
No.22 括弧の対応
|
| コンテスト | |
| ユーザー |
3405691582
|
| 提出日時 | 2019-12-06 19:48:30 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 348 bytes |
| コンパイル時間 | 4,655 ms |
| コンパイル使用メモリ | 173,824 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 07:45:58 |
| 合計ジャッジ時間 | 5,390 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
コンパイルメッセージ
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
ソースコード
pB :: Int -> [Int] -> [(Char, Int)] -> Int
pB k ns ((b,n'):bs) =
if b == '(' then
pB k (n':ns) bs
else
case ns of
[] -> 0
(n:ns') ->
if n == k then n'
else if n' == k then n
else pB k ns' bs
main = do
[n,k] <- (map read . words) <$> getLine
s <- getLine
putStrLn $ show $ pB k [] $ zip s [1..]
3405691582