結果
| 問題 |
No.693 square1001 and Permutation 2
|
| コンテスト | |
| ユーザー |
mixjuice
|
| 提出日時 | 2018-06-26 17:14:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 447 bytes |
| コンパイル時間 | 2,081 ms |
| コンパイル使用メモリ | 194,680 KB |
| 最終ジャッジ日時 | 2025-01-06 11:36:46 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,ans = 0;
cin >> n;
int a[n];
rep(i,n){
cin >> a[i];
}
sort(a, a+n);
rep(i,n){
while(1){
if(a[i] == i + 1) break;
else{
a[i]++;
ans++;
}
}
}
cout << ans << endl;
return 0;
}
mixjuice