結果
| 問題 |
No.1134 Deviation Score Ⅱ
|
| ユーザー |
|
| 提出日時 | 2022-07-19 09:07:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,113 bytes |
| コンパイル時間 | 1,537 ms |
| コンパイル使用メモリ | 169,588 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-01 11:07:25 |
| 合計ジャッジ時間 | 2,741 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 WA * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int N, M;
cin >> N;
vector<ll> x(N);
for(int i = 0; i < N; i++)cin >> x[i];
cin >> M;
ll Ave = accumulate(x.begin(), x.end(), 0ll), S = 0;
for(int i = 0; i < N; i++){
S += (N * x[i] - Ave) * (N * x[i] - Ave);
}
if(S == 0){
cout << 50 << endl;
return 0;
}
if(N * x[M - 1] >= Ave){
auto f = [&](ll v){
ll d = (N * x[M - 1] - Ave) * 10;
d *= d * N;
return (v * v * S <= d);
};
ll ok = 0, ng = 100;
while(ok + 1 < ng){
ll m = (ok + ng) / 2;
if(f(m))ok = m;
else ng = m;
}
cout << 50 + ok << endl;
}else{
auto f = [&](ll v){
ll d = (N * x[M - 1] - Ave) * 10;
d *= d * N;
return (v * v * S >= d);
};
ll ng = 0, ok = 100;
while(ng + 1 < ok){
ll m = (ok + ng) / 2;
if(f(m))ok = m;
else ng = m;
}
cout << 50 - ok << endl;
}
}