CARVIEW |
Select Language
HTTP/2 200
date: Wed, 15 Oct 2025 01:40:42 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=13a3f74f4f1a9a2b86565c3e1581b2bf26d3be269ce1e30fbc09394b60af7d63a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22K60w43VtTyB5IrrVL61ojAw63S6qfIko%22%3B%7D; HttpOnly; Path=/
cf-ray: 98eb9c25c956c1a4-BLR
mmcs-olimp-2011-task1 - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 1
- open2close '(' = ')'
- open2close '[' = ']'
- open2close '{' = '}'
- open2close '<' = '>'
- close2open ')' = '('
- close2open ']' = '['
- close2open '}' = '{'
- close2open '>' = '<'
- isOpen c = elem c "({[<"
- complete str = impl str "" "" where
- -- параметры impl: targetStringTail stack result
- impl "" "" res = res
- impl "" st res = res ++ map open2close st
- impl (c:cs) "" res
- | isOpen c = impl cs [c] (res ++ [c])
- | otherwise = impl cs "" (res ++ [close2open c, c])
- impl (c:cs) st@(d:ds) res
- | isOpen c = impl cs (c:st) (res ++ [c])
- | otherwise =
- if
- close2open c == d
- then
- impl cs ds (res ++ [c])
- else
- uncurry (impl cs) $ fix (close2open c) st res
- -- если встретили в строке неожиданную закрывающую скобку,
- -- пытаемся исправить это с помощью соовтетствующей
- -- открывающей скобки c из стека, если таковая была
- fix c st res
- | not $ elem c st = (st, (res ++ [c, open2close c]))
- | otherwise = (st', res ++ a' ++ [open2close c])
- where
- (a, b) = span (/= c) st
- a' = reverse $ map open2close a
- st' = tail b
Advertisement
Add Comment
Please, Sign In to add comment
-
💡 EASY MONEY GUIDE ✅ Working
JavaScript | 7 sec ago | 0.24 KB
-
⚡ Crypto Swap Glitch ✅ Working ⚡
JavaScript | 18 sec ago | 0.24 KB
-
💵 Make 3000$ in 20 minutes 💵
JavaScript | 29 sec ago | 0.24 KB
-
🔥 Exchange profit method
JavaScript | 38 sec ago | 0.24 KB
-
🚨 Free Crypto Method 🚨
JavaScript | 57 sec ago | 0.24 KB
-
💡 Instant BTC Profit Method ✅ Working
JavaScript | 1 min ago | 0.24 KB
-
📝 MAKE $2500 IN 15 MIN ✅ Working
JavaScript | 1 min ago | 0.24 KB
-
🚀 Swapzone +37% glitch
JavaScript | 1 min ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand