結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
ユーザー 遭難者遭難者
提出日時 2024-02-23 22:36:51
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 1,462 bytes
コンパイル時間 6,193 ms
コンパイル使用メモリ 343,536 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-27 05:16:49
合計ジャッジ時間 8,659 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 26 ms
6,940 KB
testcase_02 AC 21 ms
6,944 KB
testcase_03 AC 21 ms
6,940 KB
testcase_04 AC 21 ms
6,940 KB
testcase_05 AC 22 ms
6,940 KB
testcase_06 AC 22 ms
6,940 KB
testcase_07 AC 23 ms
6,944 KB
testcase_08 AC 21 ms
6,940 KB
testcase_09 AC 22 ms
6,940 KB
testcase_10 AC 22 ms
6,944 KB
testcase_11 AC 21 ms
6,944 KB
testcase_12 AC 22 ms
6,940 KB
testcase_13 AC 21 ms
6,940 KB
testcase_14 AC 21 ms
6,940 KB
testcase_15 AC 21 ms
6,944 KB
testcase_16 AC 21 ms
6,948 KB
testcase_17 AC 21 ms
6,944 KB
testcase_18 AC 21 ms
6,940 KB
testcase_19 AC 21 ms
6,944 KB
testcase_20 AC 22 ms
6,940 KB
testcase_21 AC 21 ms
6,940 KB
testcase_22 AC 22 ms
6,940 KB
testcase_23 AC 22 ms
6,940 KB
testcase_24 AC 21 ms
6,940 KB
testcase_25 AC 20 ms
6,940 KB
testcase_26 AC 24 ms
6,940 KB
testcase_27 AC 21 ms
6,944 KB
testcase_28 AC 21 ms
6,940 KB
testcase_29 AC 22 ms
6,940 KB
testcase_30 AC 21 ms
6,940 KB
testcase_31 AC 22 ms
6,944 KB
testcase_32 AC 21 ms
6,944 KB
testcase_33 AC 20 ms
6,940 KB
testcase_34 AC 21 ms
6,940 KB
testcase_35 AC 36 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i >= 0; i--)
#define ALL(a) a.begin(), a.end()
typedef long double ldouble;
#undef long
#define long long long
#define ll long
#define vec vector
using namespace std;
using mint = atcoder::modint;
ostream &operator<<(ostream &os, mint a)
{
	return os << a.val();
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &a)
{
	const int n = a.size();
	rep(i, n)
	{
		os << a[i];
		if (i + 1 != n)
			os << " ";
	}
	return os;
}
template <typename T, size_t n>
ostream &operator<<(ostream &os, array<T, n> &a)
{
	rep(i, n) os << a[i] << " \n"[i + 1 == n];
	return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &a)
{
	for (T &i : a)
		is >> i;
	return is;
}
template <typename T>
bool chmin(T &x, T y)
{
	if (x > y)
	{
		x = y;
		return true;
	}
	return false;
}
template <typename T>
bool chmax(T &x, T y)
{
	if (x < y)
	{
		x = y;
		return true;
	}
	return false;
}
void solve()
{
	int n;
	cin >> n;
	vec<long> a(n);
	cin >> a;
	long ans = 0;
	for (int i = 1; i < n; i++)
		chmax(ans, a[i - 1] - a[i] + 1);
	cout << ans << '\n';
}
int main()
{
	// srand((unsigned)time(NULL));
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	// cout << fixed << setprecision(400);
	int t = 1;
	cin >> t;
	while (t--)
		solve();
	return 0;
}
0