結果
問題 | No.693 square1001 and Permutation 2 |
ユーザー |
|
提出日時 | 2021-06-21 20:20:26 |
言語 | Swift (6.0.3) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 181 bytes |
コンパイル時間 | 1,162 ms |
コンパイル使用メモリ | 136,680 KB |
実行使用メモリ | 9,344 KB |
最終ジャッジ日時 | 2024-06-22 22:52:23 |
合計ジャッジ時間 | 1,699 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 |
ソースコード
let n = Int(readLine()!)!let a = readLine()!.split(separator: " ").map{Int($0)!}.sorted(by: <)var c = 0//a.reduce(0){$0 + $1}for i in 1...n{c += abs(i - a[i - 1])}print(c)