結果

問題 No.1438 Broken Drawers
ユーザー shu8Creamshu8Cream
提出日時 2021-03-26 21:49:44
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 3,593 ms
コンパイル使用メモリ 206,368 KB
実行使用メモリ 5,420 KB
最終ジャッジ日時 2023-08-19 08:01:09
合計ジャッジ時間 4,162 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 25 ms
5,332 KB
testcase_07 AC 23 ms
5,400 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 15 ms
4,376 KB
testcase_13 AC 24 ms
4,376 KB
testcase_14 AC 10 ms
4,376 KB
testcase_15 AC 38 ms
5,160 KB
testcase_16 AC 36 ms
5,104 KB
testcase_17 AC 38 ms
5,132 KB
testcase_18 AC 39 ms
5,408 KB
testcase_19 AC 40 ms
5,404 KB
testcase_20 AC 40 ms
5,332 KB
testcase_21 AC 39 ms
5,336 KB
testcase_22 AC 40 ms
5,420 KB
testcase_23 AC 41 ms
5,296 KB
testcase_24 AC 41 ms
5,288 KB
testcase_25 AC 41 ms
5,372 KB
testcase_26 AC 40 ms
5,292 KB
testcase_27 AC 41 ms
5,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
*    author:  shu8Cream
*    created: 26.03.2021 21:18:21
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<P> a(n);
    rep(i,n){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(all(a));
    int ans = 0;
    vi used(n);
    rep(i,n){
        if(used[a[i].second]) continue;
        ans++;
        used[a[i].second]=1;
        used[max(0,a[i].second-1)]=1;
    }
    cout << ans << endl;
}
0