結果

問題 No.231 めぐるはめぐる (1)
ユーザー taktak
提出日時 2019-02-15 11:08:33
言語 F#
(F# 4.0)
結果
AC  
実行時間 67 ms / 1,000 ms
コード長 714 bytes
コンパイル時間 5,160 ms
コンパイル使用メモリ 166,504 KB
実行使用メモリ 24,396 KB
最終ジャッジ日時 2023-10-12 07:23:00
合計ジャッジ時間 7,621 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
22,412 KB
testcase_01 AC 65 ms
22,368 KB
testcase_02 AC 64 ms
24,388 KB
testcase_03 AC 67 ms
22,324 KB
testcase_04 AC 67 ms
24,396 KB
testcase_05 AC 66 ms
22,272 KB
testcase_06 AC 67 ms
22,236 KB
testcase_07 AC 65 ms
22,276 KB
testcase_08 AC 66 ms
20,340 KB
testcase_09 AC 62 ms
22,300 KB
testcase_10 AC 64 ms
20,156 KB
testcase_11 AC 61 ms
22,344 KB
testcase_12 AC 66 ms
22,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

[<Measure>] type h
type Dungeon = { Exp: int</h>; Death: int</h> }

let solve dungeons =
  let dungeon = 
    dungeons
    |> Array.map (fun x -> x.Exp - 30000 * x.Death)
    |> Array.indexed
    |> Array.sortByDescending snd
    |> Array.head
    
  let isEnable = 
    dungeon
    |> snd
    |> fun x -> x * 6<h> >= 30000 * 100

  let dungeons = Array.create 6 (dungeon |> (fst >> (+) 1))

  isEnable, dungeons

let R() = stdin.ReadLine()

let N = R() |> int
let GD = Array.init N (fun _ ->
  let t = R().Split() |> Array.map (int>>(*)1</h>)
  { Exp = t.[0]; Death = t.[1]})

solve GD
|> function 
  | (true, xs) -> 
    stdout.WriteLine "YES"
    xs |> Array.iter stdout.WriteLine
  | _ -> stdout.WriteLine "NO"
0