結果

問題 No.2796 Small Matryoshka
ユーザー pia019
提出日時 2024-06-28 21:54:26
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 630 bytes
コンパイル時間 3,081 ms
コンパイル使用メモリ 259,428 KB
実行使用メモリ 14,160 KB
最終ジャッジ日時 2024-06-28 21:54:32
合計ジャッジ時間 4,909 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const long long INFLL = 1LL<<60;
const int MOD = 998244343;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n; cin >> n;
    vector<vector<ll>> Rr(n, vector<ll>(2));
    for (int i = 0; i < n; i++){
        ll r, R; cin >> r >> R;
        Rr[i][0] = R;
        Rr[i][1] = r;
    }
    sort(Rr.begin(), Rr.end());
    
    ll pre_R = 0;
    ll cnt = 0;
    for (int i=0; i < n; i++){
        if (Rr[i][1] >= pre_R){
            pre_R = Rr[i][0];
            cnt++;
        }
    }
    cout << n - cnt << endl;
}
0