結果
問題 | No.1808 Fullgold Alchemist |
ユーザー |
|
提出日時 | 2022-09-25 02:01:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 2,040 ms |
コンパイル使用メモリ | 194,104 KB |
最終ジャッジ日時 | 2025-02-07 14:40:01 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include<bits/stdc++.h>using namespace std;int main(){ios::sync_with_stdio(false);cin.tie(nullptr);long long N,M;cin>>N>>M;vector<int>A(N);for(auto &i:A)cin>>i;int ans=0,u=1e9+2;while(u-ans>1){int mid=(ans+u)/2;long long ad=0;bool ok=true;for(int i=0;i<N;i++){if(A[i]+ad<mid*M)ok=false;else ad=A[i]+ad-mid*M;}if(ok)ans=mid;else u=mid;}cout<<ans<<'\n';}