結果
| 問題 |
No.2648 [Cherry 6th Tune D] 一次元の馬
|
| コンテスト | |
| ユーザー |
遭難者
|
| 提出日時 | 2024-04-24 09:02:57 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 2,000 ms |
| コード長 | 1,312 bytes |
| コンパイル時間 | 6,312 ms |
| コンパイル使用メモリ | 332,232 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-20 02:07:27 |
| 合計ジャッジ時間 | 7,189 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 |
ソースコード
#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()
#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;
}
遭難者