結果

問題 No.1285 ゴミ捨て
ユーザー KudeKude
提出日時 2020-11-13 23:01:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 800 bytes
コンパイル時間 2,328 ms
コンパイル使用メモリ 201,892 KB
最終ジャッジ日時 2025-01-15 23:51:36
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    VI a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    multiset<int> m;
    for(int x: a) {
        auto it = m.lower_bound(x - 1);
        if (it != m.begin()) {
            it--;
            m.erase(it);
        }
        m.insert(x);
    }
    cout << m.size() << endl;
}
0