dragonc0der's blog

By dragonc0der, history, 2 days ago, In English

include <bits/stdc++.h>

using namespace std;

define ll long long

int main()

{ cin.tie(nullptr); ios::sync_with_stdio(false);

int t;
cin >> t; // Read the number of test cases

while (t--)
{
    int n;
    cin >> n;

    vector<ll int> nums(n);
    ll Max = 0;
    ll int index; 
    for (int i = 0; i < n; i++) {
        cin >> nums[i];
        if (nums[i] >= Max) {
            Max = nums[i];
            index = i;
        } 
    }
    cout << max(nums[index] + index , nums[n-1] + n-1)<< '\n';
}

return 0;

}

  • Vote: I like it
  • 0
  • Vote: I do not like it