結果

問題 No.1060 素敵な宝箱
ユーザー ikdikd
提出日時 2020-05-23 08:47:34
言語 F#
(F# 4.0)
結果
AC  
実行時間 381 ms / 2,000 ms
コード長 689 bytes
コンパイル時間 8,943 ms
コンパイル使用メモリ 198,024 KB
実行使用メモリ 47,872 KB
最終ジャッジ日時 2024-04-16 08:07:25
合計ジャッジ時間 20,349 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 350 ms
35,648 KB
testcase_01 AC 347 ms
34,644 KB
testcase_02 AC 348 ms
35,676 KB
testcase_03 AC 351 ms
35,676 KB
testcase_04 AC 354 ms
35,668 KB
testcase_05 AC 348 ms
35,668 KB
testcase_06 AC 350 ms
35,644 KB
testcase_07 AC 348 ms
35,928 KB
testcase_08 AC 349 ms
38,324 KB
testcase_09 AC 351 ms
36,148 KB
testcase_10 AC 350 ms
36,084 KB
testcase_11 AC 348 ms
36,108 KB
testcase_12 AC 358 ms
39,468 KB
testcase_13 AC 362 ms
41,156 KB
testcase_14 AC 365 ms
41,660 KB
testcase_15 AC 372 ms
45,804 KB
testcase_16 AC 367 ms
42,928 KB
testcase_17 AC 358 ms
39,096 KB
testcase_18 AC 362 ms
40,912 KB
testcase_19 AC 361 ms
40,028 KB
testcase_20 AC 370 ms
43,952 KB
testcase_21 AC 368 ms
43,640 KB
testcase_22 AC 372 ms
44,092 KB
testcase_23 AC 364 ms
40,304 KB
testcase_24 AC 380 ms
47,656 KB
testcase_25 AC 381 ms
47,744 KB
testcase_26 AC 381 ms
47,872 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (365 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
/home/judge/data/code/Main.fs(7,9): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj]
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

// Learn more about F# at http://fsharp.org

open System

[<EntryPoint>]
let main argv =
    let [| n; m |] = stdin.ReadLine().Split() |> Array.map int

    let a =
        [| for _ in 1 .. n -> stdin.ReadLine().Split() |> Array.map int64 |]

    let s =
        [| for j in 0 .. m - 1 ->
            [ for i in 0 .. n - 1 -> a.[i].[j] ]
            |> List.sum |]

    let res =
        a
        |> Array.map (fun box ->
            (Array.zip box s) |> Array.sumBy (fun (cnt, tot) -> cnt * tot))
        |> Array.sortDescending
        |> Array.mapi (fun i pt ->
            if i % 2 = 0 then pt else -pt)
        |> Array.sum

    printfn "%d" res
    0 // return an integer exit code
0