結果
問題 | No.2947 Sing a Song |
ユーザー | torus711 |
提出日時 | 2024-10-25 21:49:00 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 1,405 bytes |
コンパイル時間 | 10,210 ms |
コンパイル使用メモリ | 180,364 KB |
実行使用メモリ | 9,856 KB |
最終ジャッジ日時 | 2024-10-25 21:49:19 |
合計ジャッジ時間 | 13,804 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 8 ms
8,704 KB |
testcase_04 | AC | 9 ms
7,808 KB |
testcase_05 | AC | 13 ms
9,856 KB |
testcase_06 | AC | 8 ms
7,936 KB |
testcase_07 | AC | 8 ms
7,808 KB |
testcase_08 | AC | 9 ms
7,936 KB |
testcase_09 | AC | 8 ms
7,936 KB |
testcase_10 | AC | 8 ms
7,936 KB |
testcase_11 | AC | 8 ms
8,064 KB |
testcase_12 | AC | 10 ms
7,936 KB |
testcase_13 | AC | 11 ms
8,064 KB |
testcase_14 | AC | 8 ms
8,064 KB |
testcase_15 | AC | 8 ms
8,064 KB |
testcase_16 | AC | 8 ms
7,808 KB |
testcase_17 | AC | 8 ms
8,064 KB |
testcase_18 | AC | 9 ms
8,064 KB |
testcase_19 | AC | 10 ms
7,808 KB |
testcase_20 | AC | 13 ms
7,808 KB |
testcase_21 | AC | 8 ms
8,064 KB |
testcase_22 | AC | 9 ms
7,936 KB |
testcase_23 | AC | 14 ms
7,936 KB |
testcase_24 | AC | 15 ms
7,936 KB |
testcase_25 | AC | 13 ms
7,936 KB |
testcase_26 | AC | 15 ms
7,936 KB |
testcase_27 | AC | 24 ms
8,064 KB |
コンパイルメッセージ
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
ソースコード
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE BinaryLiterals #-} {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE NumDecimals #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -O2 #-} {-# OPTIONS_GHC -Wno-tabs #-} import Control.Applicative import Control.Arrow import Control.Monad import Control.Monad.ST import Data.Char import Data.List import Data.Maybe import qualified Data.ByteString.Char8 as B import Data.Array import Data.Array.ST.Safe import Data.STRef import Debug.Trace import Text.Printf readInt = readLn :: IO Int readInteger = readLn :: IO Integer readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine which a b f = if f then a else b yesno = which "Yes" "No" mp [ a, b ] = ( a, b ) modifyArray a i f = writeArray a i =<< f <$> readArray a i printList :: Show a => [a] -> IO () printList = putStrLn . intercalate " " . map show main = do n <- readInt [ s, t ] <- words <$> getLine as <- readInts let ls = length s lt = length t mapM_ putStrLn $ do a <- as let numS = solve ls lt a numT = ( a - ls * numS ) `div` lt return $ intercalate " " ( replicate numS s ++ replicate numT t ) solve a b n = last $ do i <- takeWhile ( ( <= n ) . ( * a ) ) [ 0 .. n ] guard $ ( n - i * a ) `mod` b == 0 return i