結果
| 問題 |
No.2648 [Cherry 6th Tune D] 一次元の馬
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-11-20 15:55:43 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,210 bytes |
| コンパイル時間 | 2,983 ms |
| コンパイル使用メモリ | 278,548 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-11-20 15:55:50 |
| 合計ジャッジ時間 | 6,114 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define nl "\n"
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define umap unordered_map
#define uset unordered_set
#define MOD 1000000007
#define exp 1e9
#define sz(x) (int((x).size()))
#define forn(i, a, b) for (long long i = a; i < b; i++)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
void solve()
{
int n;
cin >> n;
vi a(n);
for (auto &i : a)
cin >> i;
int ans = 0;
bool isSorted = true;
for (int i = 1; i < n; i++)
{
if (a[i] <= a[i - 1])
{
isSorted = false;
break;
}
}
if (isSorted)
{
cout << 0 << endl;
}
else
{
int maxDiff = INT_MIN;
for (int i = 1; i < n; i++)
{
int diff = abs(a[i] - a[i - 1]);
maxDiff = max(maxDiff, diff);
}
cout << maxDiff + 1 << endl;
}
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tc = 1;
cin >> tc;
// cout << tc;
while (tc--)
{
solve();
}
}
vjudge1