結果
問題 |
No.2796 Small Matryoshka
|
ユーザー |
|
提出日時 | 2024-06-28 21:35:38 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.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 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 11 |
ソースコード
#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; }