結果
問題 | No.2036 Max Middle |
ユーザー |
![]() |
提出日時 | 2022-08-12 21:52:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 445 bytes |
コンパイル時間 | 2,135 ms |
コンパイル使用メモリ | 194,896 KB |
最終ジャッジ日時 | 2025-01-30 21:02:52 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main() {ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;vector<int> a(n);for (int i = 0; i < n; i++) {cin >> a[i];}ll r = 0;int k = 0;for (int i = 1; i < n; i++) {if (a[i - 1] < a[i]) {k++;} else {r += k;}}cout << r << endl;return 0;}