結果

問題 No.2796 Small Matryoshka
ユーザー Fu_L
提出日時 2024-07-10 16:50:31
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 711 bytes
コンパイル時間 3,385 ms
コンパイル使用メモリ 258,836 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-10 16:50:38
合計ジャッジ時間 6,405 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, a, b) for(ll i = a; i < b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)
constexpr ll inf = 4e18;
struct SetupIO {
    SetupIO() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout << fixed << setprecision(30);
    }
} setup_io;
int main(void) {
    ll n;
    cin >> n;
    vector<P> r(n);
    rep(i, 0, n) {
        cin >> r[i].first >> r[i].second;
    }
    ranges::sort(r);
    ranges::reverse(r);
    ll ans = n;
    ll cur = inf;
    rep(i, 0, n) {
        if(r[i].second <= cur) {
            ans--;
            cur = r[i].first;
        }
    }
    cout << ans << '\n';
}
0