結果
| 問題 |
No.1808 Fullgold Alchemist
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-30 13:16:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 752 bytes |
| コンパイル時間 | 767 ms |
| コンパイル使用メモリ | 81,600 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 01:22:18 |
| 合計ジャッジ時間 | 4,220 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 WA * 1 |
ソースコード
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<ctime>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
typedef long long LL;
const int MR=2e5+10;
int n,m,a[MR];
bool check(LL x){
LL r=0;
for(int i=1;i<=n;i++){
if(a[i] >= m*x){
r+=a[i]-m*x;
}
else{
r-=m*x-a[i];
if(r<0) return false;
}
}
return true;
}
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++) cin>>a[i];
int l=0,r=1e9;
while(l+1<r){
int mid=(l+r)/2;
if(check(mid)){
l=mid;
}
else{
r=mid;
}
}
cout<<l<<endl;
return 0;
}