結果
| 問題 | No.1438 Broken Drawers | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-03-26 21:35:23 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 62 ms / 2,000 ms | 
| コード長 | 424 bytes | 
| コンパイル時間 | 1,499 ms | 
| コンパイル使用メモリ | 167,468 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-28 22:08:50 | 
| 合計ジャッジ時間 | 3,570 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int ans = N, s = 1;
    rep(i, N - 1) {
        if (A[i + 1] < A[i]) {
            s++;
        } else {
            ans -= s / 2;
            s = 1;
        }
    }
    ans -= s / 2;
    cout << ans << "\n";
}
            
            
            
        