結果

問題 No.799 赤黒かーどげぇむ
コンテスト
ユーザー tanson
提出日時 2025-11-28 00:46:15
言語 Standard ML
(MLton 20210117)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 701 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,470 ms
コンパイル使用メモリ 687,228 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-28 00:46:23
合計ジャッジ時間 5,560 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fun readInt () =
    valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn)


fun member x nil = false
  | member x (h::tl) =
    if x = h
    then true
    else member x tl


val () =
    let
        val a = readInt ()
        val b = readInt ()
        val c = readInt ()
        val d = readInt ()

        val all = (b - a + 1) * (d - c + 1)
        val ab = List.tabulate (b - a + 1, fn x => a + x)
        val cd = List.tabulate (d - c + 1, fn x => c + x)
        val sameValues =
            List.filter
                (fn x =>
                    member x cd)
                ab
        val ans = all - (List.length sameValues)
    in
        print (Int.toString ans ^ "\n")
    end
0