結果

問題 No.1338 Giant Class
ユーザー natoriusannatoriusan
提出日時 2023-07-30 23:56:03
言語 F#
(F# 4.0)
結果
AC  
実行時間 1,020 ms / 2,000 ms
コード長 1,072 bytes
コンパイル時間 6,268 ms
コンパイル使用メモリ 197,008 KB
実行使用メモリ 62,844 KB
最終ジャッジ日時 2024-04-18 01:09:22
合計ジャッジ時間 22,208 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 317 ms
34,316 KB
testcase_01 AC 315 ms
34,008 KB
testcase_02 AC 746 ms
57,392 KB
testcase_03 AC 306 ms
34,140 KB
testcase_04 AC 308 ms
34,060 KB
testcase_05 AC 309 ms
34,136 KB
testcase_06 AC 703 ms
61,048 KB
testcase_07 AC 876 ms
61,744 KB
testcase_08 AC 729 ms
61,360 KB
testcase_09 AC 665 ms
59,568 KB
testcase_10 AC 989 ms
62,636 KB
testcase_11 AC 385 ms
44,792 KB
testcase_12 AC 785 ms
58,924 KB
testcase_13 AC 671 ms
61,940 KB
testcase_14 AC 414 ms
52,112 KB
testcase_15 AC 438 ms
58,612 KB
testcase_16 AC 347 ms
42,676 KB
testcase_17 AC 687 ms
61,060 KB
testcase_18 AC 383 ms
52,464 KB
testcase_19 AC 466 ms
58,672 KB
testcase_20 AC 996 ms
62,844 KB
testcase_21 AC 1,020 ms
62,728 KB
testcase_22 AC 1,011 ms
62,716 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (210 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
/home/judge/data/code/Main.fs(1,5): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj]
/home/judge/data/code/Main.fs(8,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 #

let [|h; w; q|] = stdin.ReadLine().Split " " |> Array.map int


let mutable available = (int64 h) * (int64 w)
let mutable M = Map.empty

for _ in 0..q-1 do
    let [|y; x|] = stdin.ReadLine().Split " " |> Array.map int
    let minus =
        if Map.containsKey (x-1) M then
            let m = M.[x-1] - y
            if m < 0 then
                0
            else
                M <- M.Add (x-1, y)
                m
        else
            M <- M.Add (x-1, y)
            (h+1) - y
    available <- available - (int64 minus)
    printfn "%d" available
    
    
// let arr =
//     [|
//         for i in 0..q-1 ->
//             let [|y; x|] = stdin.ReadLine().Split " " |> Array.map int
//             x, y
//     |] |> Array.sort |> Array.rev
//     
// let rec count prev_x value index =
//     if index = arr.Length then
//         value
//     else
//         let x, y = arr.[index]
//         if prev_x <> x then
//             count x (value+y) (index+1)
//         else
//             count x value (index+1)
//             
// count -1 0 0 |> printfn "%d"
0