結果
| 問題 |
No.292 芸名
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-25 18:34:25 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 486 bytes |
| コンパイル時間 | 1,688 ms |
| コンパイル使用メモリ | 176,768 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 19:15:01 |
| 合計ジャッジ時間 | 2,175 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:11:26: warning: [GHC-63394] [-Wx-partial]
In the use of ‘tail’
(imported from Prelude, but defined in GHC.List):
"This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
|
11 | s2 = tail $ drop x ss
| ^^^^
Main.hs:13:26: warning: [GHC-63394] [-Wx-partial]
In the use of ‘tail’
(imported from Prelude, but defined in GHC.List):
"This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
|
13 | s4 = tail $ drop z s2
| ^^^^
[2 of 2] Linking a.out
ソースコード
rInt :: String -> Int
rInt = read
xys x y = if x < y then [x, y] else [y, x]
solve ss x y | x == y = s1 ++ s2
| otherwise = s1 ++ s3 ++ s4
where
z = y - x - 1
s1 = take x ss
s2 = tail $ drop x ss
s3 = take z s2
s4 = tail $ drop z s2
main = do
[ss, t, u] <- words <$> getLine
let [x, y] = xys (rInt t) (rInt u)
putStrLn $ solve ss x y