結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
コンテスト
ユーザー vjudge1
提出日時 2026-11-20 03:18:25
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 3,329 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,042 ms
コンパイル使用メモリ 359,320 KB
実行使用メモリ 9,872 KB
最終ジャッジ日時 2026-11-20 03:18:35
合計ジャッジ時間 9,234 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

//Bismillah
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define nl cout<<"\n";
#define YN(condition) cout<<(condition?"YES":"NO")
#define yn(condition) cout<<(condition?"Yes":"No")

#define int long long
#define lint __int128
#define ll long long
#define ld long double
#define pii pair<int,int>
const int inf = 1e17;
const int MOD = 1000000007;

#define ac(n) array<char,n>
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define mp map<int,int>
#define pq priority_queue<int>
#define pqpair priority_queue<pair<int,int>>
#define pqmin priority_queue<int, vector<int>, greater<int>>
#define pqminpair priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>

#define f(i,s,e) for(int i=s;i<e;i++)
#define fn(i,s,e) for(int i=s;i>=e;i--)
#define printv(vec) for(auto &value: vec) cout<<value<<" ";
#define inputv(vec) for(auto &value: vec) cin>>value;

#define pb push_back
#define pp pop_back
#define all(s) s.begin(), s.end()
#define sa(vec) sort(vec.begin(), vec.end())
#define sd(vec) sort(vec.begin(), vec.end(), [](int a, int b){return a>b;})

template <typename T>
using ordered_set = tree<
    T,           // key type
    null_type,   // mapped type (null => set)
    less<T>,     // ordering
    rb_tree_tag, // red-black tree
    tree_order_statistics_node_update>;
// .find_by_order(k) returns iterator of kth smallest element (0 based)
// .order_of_key(k) returns number of elements < x

template <typename A, typename B>
istream& operator>>(istream &in, pair<A,B> &p) {
    in >> p.first >> p.second;
    return in;
}
template <typename T>
istream& operator>>(istream &in, vector<T> &v) {
    for (auto &x : v) in >> x;
    return in;
}
template <typename A, typename B>
istream& operator>>(istream &in, vector<pair<A,B>> &vp) {
    for (auto &p : vp) in >> p.first >> p.second;
    return in;
}
template <typename A, typename B>
ostream& operator<<(ostream &out, const pair<A,B> &p) {
    out << p.first << " " << p.second;
    return out;
}
template <typename T>
ostream& operator<<(ostream &out, const vector<T> &v) {
    for (auto &x : v) out << x << " ";
    return out;
}
template <typename A, typename B>
ostream& operator<<(ostream &out, const vector<pair<A,B>> &vp) {
    for (auto &p : vp) out << p.first << " " << p.second << "\n";
    return out;
}

#define fastnuces ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t = 1;
int test=0;
void solve(){
    int n;
    cin >> n;
    vi nums(n+1);
    vi nums2(n+1);
    for (int i=1; i<=n; i++) {
        cin >> nums[i];
    }
    int l=0, r=1e9, m;
    bool check;
    while (l <= r) {
        m = l + (r - l) / 2;
        if (l==r) break;
        check = true;
        for (int i=1; i<=n; i++) {
            nums2[i] = nums[i] + (i * m);
            if (i > 1 && nums2[i-1] >= nums2[i]) {
                check = false;
                break;
            }
        }
        if (check) {
            r = m;
        } else {
            l = m+1;
        }
    }
    cout << m;
}
signed main() {
    fastnuces;
    cin >> t;
    while (t--) {
        test++;
        solve();
        nl
    }
    return 0;
}
0