結果
問題 |
No.2648 [Cherry 6th Tune D] 一次元の馬
|
ユーザー |
|
提出日時 | 2024-03-04 00:08:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 835 bytes |
コンパイル時間 | 1,797 ms |
コンパイル使用メモリ | 192,824 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-06-20 02:05:23 |
合計ジャッジ時間 | 4,321 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; template<class T> istream& operator >> (istream& is, vector<T>& vec) { for(T& x : vec) is >> x; return is; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int T; cin >> T; while(T--){ int n; cin >> n; vector<int> a(n); cin >> a; ll ng = -1, ok = 1'000'000'001, mid; while(ng + 1 < ok){ mid = (ng + ok) / 2; bool flg = true; ll mx = -1; for(int i = 0; i < n; i++){ ll v = a[i] + (i + 1) * mid; if(v <= mx){ flg = false; break; } mx = v; } (flg ? ok : ng) = mid; } cout << ok << '\n'; } }