結果
| 問題 | No.231 めぐるはめぐる (1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-15 21:04:14 |
| 言語 | Haskell (9.14.1) |
| 結果 |
MLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 517 bytes |
| 記録 | |
| コンパイル時間 | 1,345 ms |
| コンパイル使用メモリ | 195,840 KB |
| 実行使用メモリ | 206,080 KB |
| 最終ジャッジ日時 | 2026-04-01 23:24:05 |
| 合計ジャッジ時間 | 2,140 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 MLE * 1 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:20:21: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in GHC.Internal.List):
"This is a partial function, it throws an error on empty lists. Use pattern matching, 'Data.List.uncons' or 'Data.Maybe.listToMaybe' instead. Consider refactoring to use "Data.List.NonEmpty"."
|
20 | let (no, eff) = head $ sortBy by ds
| ^^^^
[2 of 2] Linking a.out
ソースコード
module Main where
import Control.Monad
import Data.List (sortBy)
expNeeded = 30000 * 100
desupena = 30000
exp_h :: [Int] -> Int
exp_h [g, d] = g - d * desupena
by (_, a) (_, b) = b `compare` a
main :: IO ()
main = do
n <- readLn
ds <- fmap (zip [1..])
. replicateM n
$ exp_h . fmap read . words <$> getLine
let (no, eff) = head $ sortBy by ds
if eff * 6 < expNeeded
then putStrLn "NO"
else do
putStrLn "YES"
replicateM_ 6 (print no)