結果
問題 |
No.2648 [Cherry 6th Tune D] 一次元の馬
|
ユーザー |
|
提出日時 | 2024-12-11 17:07:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 703 bytes |
コンパイル時間 | 706 ms |
コンパイル使用メモリ | 75,428 KB |
実行使用メモリ | 8,960 KB |
最終ジャッジ日時 | 2025-06-20 02:18:49 |
合計ジャッジ時間 | 3,655 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 |
ソースコード
#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; }