結果

問題 No.322 Geometry Dash
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-07-14 19:37:50
言語 Haskell
(9.8.2)
結果
AC  
実行時間 375 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 8,798 ms
コンパイル使用メモリ 180,416 KB
実行使用メモリ 36,096 KB
最終ジャッジ日時 2024-04-26 06:16:18
合計ジャッジ時間 21,949 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 76 ms
26,112 KB
testcase_05 AC 240 ms
30,208 KB
testcase_06 AC 292 ms
32,000 KB
testcase_07 AC 321 ms
33,152 KB
testcase_08 AC 304 ms
34,304 KB
testcase_09 AC 236 ms
30,976 KB
testcase_10 AC 291 ms
32,256 KB
testcase_11 AC 335 ms
32,256 KB
testcase_12 AC 365 ms
33,152 KB
testcase_13 AC 353 ms
35,072 KB
testcase_14 AC 307 ms
32,128 KB
testcase_15 AC 341 ms
32,000 KB
testcase_16 AC 342 ms
32,128 KB
testcase_17 AC 357 ms
33,280 KB
testcase_18 AC 365 ms
33,152 KB
testcase_19 AC 308 ms
32,256 KB
testcase_20 AC 333 ms
32,256 KB
testcase_21 AC 351 ms
33,024 KB
testcase_22 AC 342 ms
33,024 KB
testcase_23 AC 375 ms
35,328 KB
testcase_24 AC 322 ms
35,072 KB
testcase_25 AC 344 ms
33,024 KB
testcase_26 AC 351 ms
35,328 KB
testcase_27 AC 356 ms
35,328 KB
testcase_28 AC 357 ms
36,096 KB
testcase_29 AC 259 ms
28,928 KB
testcase_30 AC 281 ms
32,000 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

ソースコード

diff #

import Control.Applicative ((<$>))
import qualified Data.ByteString.Char8 as C
import Data.List (sortBy)
import Data.Maybe (fromJust)

type Spot k v = (k, v, v)

compareSpots :: (Num v, Ord v) => Spot k v -> Spot k v -> Ordering
compareSpots (_, t1, d1) (_, t2, d2) = compare (t2 * d1) $ t1 * d2

optimizeSeq :: (Num k, Num v, Ord v) => [Spot k v] -> [k]
optimizeSeq = fmap f . sortBy compareSpots
    where f (i, _, _) = i

unsafeReadInt :: C.ByteString -> Int
unsafeReadInt = fst . fromJust . C.readInt

main :: IO ()
main = do
    n <- unsafeReadInt <$> C.getLine
    ts <- fmap unsafeReadInt . C.words <$> C.getLine
    ds <- fmap unsafeReadInt . C.words <$> C.getLine
    let ss = optimizeSeq $ zipWith3 g [1 .. n] ts ds
    putStrLn . unwords $ fmap show ss
    where
        g i t s = (i, t, s)
0