結果
問題 |
No.609 Noelちゃんと星々
|
ユーザー |
![]() |
提出日時 | 2018-05-29 18:25:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 473 bytes |
コンパイル時間 | 1,552 ms |
コンパイル使用メモリ | 173,556 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 08:02:20 |
合計ジャッジ時間 | 4,013 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
main.cpp:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 16 | main(){ | ^~~~
ソースコード
#include<bits/stdc++.h> #define rep(i, n) for(int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; ll LINF = (1LL << 61) - 1; int INF = (1LL << 30) - 1; int MOD = 1e9+7; vector<int> V; ll getAbs(ll mid){ ll sum = 0; for(auto i:V){ sum += abs(i - mid); } return sum; } main(){ int N; cin >> N; V.resize(N); rep(i,N){ cin >> V[i]; } sort(V.begin(), V.end()); cout << getAbs(V[N/2]) << endl; }