結果

問題 No.693 square1001 and Permutation 2
ユーザー varrhovarrho
提出日時 2019-09-23 03:07:51
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 204 bytes
コンパイル時間 3,468 ms
コンパイル使用メモリ 65,556 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 04:10:59
合計ジャッジ時間 4,171 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import algorithm, sequtils, strutils
let n: int = stdin.readline.parseInt
var
  a: seq[int] = stdin.readline.split.map(parseInt)
  ans: int = 0
a.sort()
for i in 0..<n:
  ans += abs(i + 1 - a[i])
echo ans
0