結果
| 問題 | No.2036 Max Middle |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-14 20:17:39 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 551 bytes |
| 記録 | |
| コンパイル時間 | 4,273 ms |
| コンパイル使用メモリ | 374,212 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-14 20:17:46 |
| 合計ジャッジ時間 | 6,277 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
void solve()
{
int n; cin >> n;
vector<int> a(n);
for(int i=0; i<n; ++i) cin >> a[i];
int r = 0;
ll answer = 0;
for (int i=1; i<n; ++i)
{
if (a[i] > a[i-1]) r++;
else answer += (ll)r;
}
cout << answer << "\n";
}
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t = 1;
// std::cin >> t;
while (t--)
solve();
return 0;
}