結果
問題 | No.609 Noelちゃんと星々 |
ユーザー |
|
提出日時 | 2017-12-11 20:55:29 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 330 bytes |
コンパイル時間 | 1,346 ms |
コンパイル使用メモリ | 163,792 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-30 11:30:46 |
合計ジャッジ時間 | 3,155 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;int main(void) {int n;cin >> n;vector<ll> y(n);for (int i = 0; i < n; i++) {cin >> y[i];}sort(y.begin(), y.end());ll ans = 0;for (int i = 0; i < n; i++) {ans += abs(y[i] - y[n / 2]);}cout << ans << endl;return 0;}