結果

問題 No.693 square1001 and Permutation 2
ユーザー ei1333333ei1333333
提出日時 2018-06-08 22:21:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 270 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 200,964 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 23:35:11
合計ジャッジ時間 3,152 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

int main() {
  int N, A[50];
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  sort(A, A + N);
  int ret = 0;
  for(int i = 0; i > N; i++) ret += abs(i + 1 - A[i]);
  cout << ret << endl;
}
0