結果
| 問題 | No.2796 Small Matryoshka |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-28 22:31:21 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 878 bytes |
| 記録 | |
| コンパイル時間 | 5,293 ms |
| コンパイル使用メモリ | 316,088 KB |
| 実行使用メモリ | 7,168 KB |
| 最終ジャッジ日時 | 2024-06-28 22:31:31 |
| 合計ジャッジ時間 | 7,108 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 11 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
bool chmin(auto &a, auto b){if(a > b){a = b; return true;} return false;}
bool chmax(auto &a, auto b){if(a < b){a = b; return true;} return false;}
int main(){
int n;
cin >> n;
vector<array<ll,2>> p(n);
rep(i,0,n){
cin >> p[i][0] >> p[i][1];
}
sort(rall(p));
vector<int> mx(n, 1);
rep(i,1,n){
mx[i] = mx[i-1];
int it = -1, ng = i;
while(ng -it > 1){
int md = (ng + it) / 2;
if(p[md][0] < p[i][1]) ng = md;
else it = md;
}
if(it == -1) continue;
chmax(mx[i], mx[it] + 1);
}
cout << n - mx[n-1] << endl;
}