結果
問題 | No.2648 [Cherry 6th Tune D] 一次元の馬 |
ユーザー |
|
提出日時 | 2024-12-11 17:07:10 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 703 bytes |
コンパイル時間 | 903 ms |
コンパイル使用メモリ | 77,964 KB |
実行使用メモリ | 9,088 KB |
最終ジャッジ日時 | 2024-12-11 17:07:15 |
合計ジャッジ時間 | 5,518 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
#include <iostream>#include <cstdint>#include <vector>using namespace std;int main(){cin.tie(nullptr);ios::sync_with_stdio(false);int32_t T, i, j;cin >> T;vector<int32_t> N(T);vector<vector<int32_t>> A(T, vector<int32_t>());for (i = 0; i != T; ++i){cin >> N[i];A[i].resize(N[i]);for (j = 0; j != N[i]; ++j)cin >> A[i][j];}for (i = 0; i != T; ++i){auto l = -1, r = 1'000'000'001;while (l + 1 < r){const auto c = (l + r) / 2;for (j = 1; j != N[i]; ++j)if (A[i][j - 1] + static_cast<int64_t>(j) * c >= A[i][j] + static_cast<int64_t>(j + 1) * c)break;if (j == N[i]) r = c;else l = c;}cout << r << '\n';}return 0;}