Submission #22299505
Source Code Expand
import Data.List
modulus = 10^9+7
main :: IO ()
main = do
n <- readLn
s1 <- getLine
s2 <- getLine
print $ solve n s1 s2
solve :: Int -> String -> String -> Int
solve n s1 s2 = foldl' go (if hp == 1 then 3 else 6) $ zip patterns $ tail patterns
where
patterns = map length $ group s1
hp = head patterns
go acc (1, 1) = acc `modMul` 2
go acc (1, 2) = acc `modMul` 2
go acc (2, 1) = acc
go acc (2, 2) = acc `modMul` 3
modMul :: Int -> Int -> Int
modMul a b = a * b `mod` modulus
Submission Info
| Submission Time | |
|---|---|
| Task | D - Coloring Dominoes |
| User | orepuri |
| Language | Haskell (GHC 8.8.3) |
| Score | 400 |
| Code Size | 535 Byte |
| Status | AC |
| Exec Time | 8 ms |
| Memory | 3836 KiB |
Compile Error
Loaded package environment from /home/contestant/.ghc/x86_64-linux-8.8.3/environments/default
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample1.txt, sample2.txt, sample3.txt |
| All | sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 1.txt | AC | 8 ms | 3704 KiB |
| 10.txt | AC | 2 ms | 3700 KiB |
| 11.txt | AC | 2 ms | 3708 KiB |
| 12.txt | AC | 2 ms | 3832 KiB |
| 13.txt | AC | 2 ms | 3756 KiB |
| 14.txt | AC | 5 ms | 3600 KiB |
| 15.txt | AC | 2 ms | 3628 KiB |
| 16.txt | AC | 3 ms | 3744 KiB |
| 17.txt | AC | 6 ms | 3740 KiB |
| 18.txt | AC | 6 ms | 3752 KiB |
| 19.txt | AC | 2 ms | 3756 KiB |
| 2.txt | AC | 2 ms | 3724 KiB |
| 20.txt | AC | 2 ms | 3828 KiB |
| 21.txt | AC | 2 ms | 3756 KiB |
| 22.txt | AC | 2 ms | 3640 KiB |
| 3.txt | AC | 2 ms | 3632 KiB |
| 4.txt | AC | 2 ms | 3708 KiB |
| 5.txt | AC | 3 ms | 3688 KiB |
| 6.txt | AC | 2 ms | 3612 KiB |
| 7.txt | AC | 2 ms | 3588 KiB |
| 8.txt | AC | 3 ms | 3732 KiB |
| 9.txt | AC | 1 ms | 3752 KiB |
| sample1.txt | AC | 2 ms | 3648 KiB |
| sample2.txt | AC | 8 ms | 3728 KiB |
| sample3.txt | AC | 2 ms | 3836 KiB |