結果
問題 | No.693 square1001 and Permutation 2 |
ユーザー |
![]() |
提出日時 | 2018-06-08 23:03:45 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 548 bytes |
コンパイル時間 | 465 ms |
コンパイル使用メモリ | 60,120 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 10:58:05 |
合計ジャッジ時間 | 992 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 |
ソースコード
#include<iostream>#include <algorithm>#include<string>#include <bitset>using namespace std;int main(){//int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0;//cout << LONG_MAX << endl;long x[100001];//string s[1001];cin >> a;for ( b = 0; b < a; b++){cin >> x[b];}sort(x, x + a);for ( b = 0; b < a; b++){ans+=abs(b + 1 - x[b]);}cout << ans << endl;//cout << "aaaaaaa" << endl;return 0;}