結果

問題 No.2796 Small Matryoshka
ユーザー makichanmakichan
提出日時 2024-06-28 21:35:38
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,036 bytes
コンパイル時間 5,511 ms
コンパイル使用メモリ 324,604 KB
実行使用メモリ 49,564 KB
最終ジャッジ日時 2024-06-28 21:35:51
合計ジャッジ時間 10,504 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 WA -
testcase_05 AC 69 ms
10,752 KB
testcase_06 AC 572 ms
49,564 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 324 ms
25,452 KB
testcase_09 AC 496 ms
38,388 KB
testcase_10 AC 558 ms
37,952 KB
testcase_11 AC 607 ms
42,812 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using mint = atcoder::static_modint<998244353>;
//using mint = atcoder::static_modint<1000000007>;
using namespace std;
using namespace atcoder;
using ld = long double;
using ll = long long;
#define mp(a,b) make_pair(a,b)
#define rep(i,s,n) for(int i=s; i<n; i++)

int op(int x,int y){return max(x,y);}
int e(){return 0;}
int main(){
    int n;
    cin >> n;
    set<ll> S;
    vector<pair<ll,ll>> r(n);
    rep(i,0,n){
        cin >> r[i].first >> r[i].second;
        S.insert(r[i].first);
        S.insert(r[i].second);
    }
    map<ll,ll> f;
    int k=0;
    auto itr=S.begin();
    while(itr!=S.end()){
        f[*itr]=k;
        k++;
        itr++;
    }
    rep(i,0,n){
        r[i].first=f[r[i].first];
        r[i].second=f[r[i].second];
    }
    sort(r.begin(),r.end());
    segtree<int,op,e> seg(2*n);
    rep(i,0,n){
        int a=r[i].first,b=r[i].second;
        int score=seg.prod(0,a+1)+1;
        seg.set(b,score);
    }
    int ans=n-seg.all_prod();
    cout << ans;
}
0