結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
ユーザー anago-pie
提出日時 2024-02-26 01:05:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 251 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 162,024 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-20 02:05:02
合計ジャッジ時間 6,525 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define debug 0
#define YES cout << "Yes" << endl;
#define NO cout << "No" << endl;
using ll = long long;
using ld = long double;
const int mod = 998244353;
const int MOD = 1000000007;
const double pi = atan2(0, -1);
#include <time.h>
#include <chrono>

int main() {
	int T;
	cin >> T;
	rep(test, T) {
		int N;
		cin >> N;
		vector<ll> v(N);
		rep(i, N) {
			cin >> v[i];
		}
		ll ans = 0;
		rep(i, N - 1) {
			if (v[i + 1] <= v[i]) {
				ans = max(ans, v[i] - v[i + 1] + 1);
			}
		}
		cout << ans << endl;
	}
}
0