提出 #22299505
ソースコード 拡げる
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
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Coloring Dominoes |
| ユーザ | orepuri |
| 言語 | Haskell (GHC 8.8.3) |
| 得点 | 400 |
| コード長 | 535 Byte |
| 結果 | AC |
| 実行時間 | 8 ms |
| メモリ | 3836 KiB |
コンパイルエラー
Loaded package environment from /home/contestant/.ghc/x86_64-linux-8.8.3/environments/default
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| 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 |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 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 |