結果
問題 | No.2036 Max Middle |
ユーザー |
![]() |
提出日時 | 2022-08-13 04:36:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 1,441 ms |
コンパイル使用メモリ | 168,348 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 06:29:23 |
合計ジャッジ時間 | 3,249 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2022.08.13 04:36:41 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n;cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int cnt1 = 0, cnt2 = 0; for (int i = 0; i < n-1; i++) { if (a[i] < a[i+1]) cnt1++; else cnt2++; } ll ans = 0; for (int i = 0; i < n-1; i++) { if (a[i] < a[i+1]) ans += cnt2; else cnt2--; } cout << ans << endl; return 0; }