結果
問題 | No.609 Noelちゃんと星々 |
ユーザー |
![]() |
提出日時 | 2019-03-03 18:23:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 316 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 62,056 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 13:17:06 |
合計ジャッジ時間 | 2,979 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;int main(void){int n;cin >> n;long y[n];for(int i = 0; i < n; i++) cin >> y[i];sort(y, y + n);long long ans = 0;for(int i = 0; i < n; i++){ans += abs(y[i] - y[n / 2]);}cout << ans << endl;return 0;}