結果
| 問題 |
No.609 Noelちゃんと星々
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-22 14:47:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 525 bytes |
| コンパイル時間 | 543 ms |
| コンパイル使用メモリ | 66,720 KB |
| 実行使用メモリ | 20,928 KB |
| 最終ジャッジ日時 | 2024-12-17 23:10:35 |
| 合計ジャッジ時間 | 55,759 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 10 TLE * 15 |
ソースコード
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
int N;
cin>>N;
vector<LL> A(N,0);
set<LL> aSet;
LL x;
int i;
for (i=0;i<N;i++){
cin>>x;
A[i]=x;
aSet.insert(x);
}
set<LL>::iterator sit;
LL MinV=1e10;
LL Sum=0;
for (sit=aSet.begin();sit!=aSet.end();sit++){
LL v=(*sit);
Sum=0;
for (i=0;i<N;i++){
x=A[i]-v;
if (x<0){
x=-x;
}
Sum+=x;
}
if (MinV>Sum){
MinV=Sum;
}
}
cout<<MinV<<endl;
return 0;
}