結果
問題 | No.1020 Reverse |
ユーザー | poapoa |
提出日時 | 2020-07-30 12:04:17 |
言語 | Haskell (9.8.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,053 bytes |
コンパイル時間 | 12,194 ms |
コンパイル使用メモリ | 207,184 KB |
実行使用メモリ | 41,472 KB |
最終ジャッジ日時 | 2024-07-03 20:41:12 |
合計ジャッジ時間 | 13,798 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
コンパイルメッセージ
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
ソースコード
import qualified Control.Arrow as Arrow import qualified Control.Monad as Monad import qualified Data.Char as Char import qualified Data.List as List import qualified Data.ByteString.Char8 as BSC8 import qualified Data.Vector.Unboxed as VU import qualified Data.Ord as Ord getI :: BSC8.ByteString -> Maybe (Int, BSC8.ByteString) getI = fmap (Arrow.second BSC8.tail) . BSC8.readInt getAB :: IO (Int, Int) getAB = (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 getI <$> BSC8.getLine main :: IO () main = do (n, k) <- getAB s <- BSC8.unpack <$> BSC8.getLine if even (n - k) then solve' n k s else solve'' n k s solve', solve'' :: Int -> Int -> String -> IO () solve' n k s = let xs = [k, k + 1 .. n] ++ [k - 1, k - 2 .. 1] ys = zip xs s zs = List.sortBy (Ord.comparing fst) ys in print $ map snd zs solve'' n k s = let xs = [k, k + 1 .. n] ++ [1 .. k - 1] ys = zip xs s zs = List.sortBy (Ord.comparing fst) ys in print $ map snd zs