結果

問題 No.1438 Broken Drawers
ユーザー 🍮かんプリン
提出日時 2021-03-28 13:58:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 1,762 ms
コンパイル使用メモリ 167,564 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-29 09:05:07
合計ジャッジ時間 4,326 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2021.03.28 13:58:03
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n;cin >> n;
    vector<int> a(n);
    int len = 1;
    cin >> a[0];
    int ans = 0;
    for (int i = 1; i < n; i++) {
        cin >> a[i];
        if (a[i-1] < a[i]) {
            ans += (len+1)/2;
            len = 1;
        }
        else {
            len++;
        }
    }
    ans += (len+1)/2;
    cout << ans << endl;
    return 0;
}
0