結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
ユーザー inkyamaninkyaman
提出日時 2024-03-24 10:09:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 326 ms / 2,000 ms
コード長 1,081 bytes
コンパイル時間 1,278 ms
コンパイル使用メモリ 120,220 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-24 10:09:47
合計ジャッジ時間 9,126 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 136 ms
6,676 KB
testcase_02 AC 88 ms
6,676 KB
testcase_03 AC 88 ms
6,676 KB
testcase_04 AC 92 ms
6,676 KB
testcase_05 AC 90 ms
6,676 KB
testcase_06 AC 89 ms
6,676 KB
testcase_07 AC 91 ms
6,676 KB
testcase_08 AC 89 ms
6,676 KB
testcase_09 AC 92 ms
6,676 KB
testcase_10 AC 91 ms
6,676 KB
testcase_11 AC 89 ms
6,676 KB
testcase_12 AC 91 ms
6,676 KB
testcase_13 AC 91 ms
6,676 KB
testcase_14 AC 92 ms
6,676 KB
testcase_15 AC 93 ms
6,676 KB
testcase_16 AC 91 ms
6,676 KB
testcase_17 AC 91 ms
6,676 KB
testcase_18 AC 91 ms
6,676 KB
testcase_19 AC 91 ms
6,676 KB
testcase_20 AC 90 ms
6,676 KB
testcase_21 AC 91 ms
6,676 KB
testcase_22 AC 91 ms
6,676 KB
testcase_23 AC 91 ms
6,676 KB
testcase_24 AC 92 ms
6,676 KB
testcase_25 AC 90 ms
6,676 KB
testcase_26 AC 101 ms
6,676 KB
testcase_27 AC 91 ms
6,676 KB
testcase_28 AC 93 ms
6,676 KB
testcase_29 AC 92 ms
6,676 KB
testcase_30 AC 92 ms
6,676 KB
testcase_31 AC 93 ms
6,676 KB
testcase_32 AC 92 ms
6,676 KB
testcase_33 AC 87 ms
6,676 KB
testcase_34 AC 91 ms
6,676 KB
testcase_35 AC 326 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <iomanip>
#include <climits>
#include <functional>
#include <cassert>
#include <tuple>
using namespace std;
using ll = long long;

int T;

int main() {

    cin >> T;
    vector<ll> ans;
    while(T--) {
        int N;
        cin >> N;
        vector<ll> A(N+1);
        for(int i = 1; i <= N; ++i) cin >> A[i];

        ll l = -1, r = 1e10;
        while(r-l > 1) {
            ll mid = l+(r-l)/2;
            vector<ll> B(N+1);
            for(int i = 1; i <= N; ++i) B[i] = A[i]+mid*i;
            
            bool f = true;
            for(int i = 1; i <= N-1; ++i) {
                if(B[i+1] <= B[i]) {
                    f = false;
                    break;
                }
            }

            if(f) r = mid;
            else l = mid;
        }

        ans.push_back(r);
        
    }

    for(auto v : ans) cout << v << endl;

}
0