結果

問題 No.693 square1001 and Permutation 2
ユーザー taktak
提出日時 2018-08-02 05:37:51
言語 F#
(F# 4.0)
結果
AC  
実行時間 359 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 12,573 ms
コンパイル使用メモリ 196,040 KB
実行使用メモリ 36,608 KB
最終ジャッジ日時 2023-10-19 20:58:19
合計ジャッジ時間 18,285 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 358 ms
36,608 KB
testcase_01 AC 358 ms
36,608 KB
testcase_02 AC 356 ms
36,608 KB
testcase_03 AC 358 ms
36,608 KB
testcase_04 AC 359 ms
36,608 KB
testcase_05 AC 350 ms
36,272 KB
testcase_06 AC 357 ms
36,168 KB
testcase_07 AC 357 ms
36,168 KB
testcase_08 AC 358 ms
36,168 KB
testcase_09 AC 358 ms
36,168 KB
testcase_10 AC 359 ms
36,172 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (453 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

let R() = stdin.ReadLine()

let N = R() |> int
let A = R().Split() |> Array.map (int >> fun x -> x - 1) |> Array.sort

let ans = 
    A 
    |> Array.indexed 
    |> Array.fold (fun acc (idx,value) -> acc + abs(idx - value)) 0

ans |> printfn "%i"
0