結果
問題 | No.693 square1001 and Permutation 2 |
ユーザー |
|
提出日時 | 2024-03-30 13:36:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 349 bytes |
コンパイル時間 | 4,236 ms |
コンパイル使用メモリ | 251,288 KB |
最終ジャッジ日時 | 2025-02-20 15:53:28 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using ld = long double; int N, ans; int A[55]; int main() { cin >> N; for (int i = 1; i <= N; i++) cin >> A[i]; sort(A + 1, A + N + 1); for (int i = 1; i <= N; i++) ans += abs(A[i] - i); cout << ans << endl; return 0; }