結果
| 問題 |
No.2796 Small Matryoshka
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-28 21:28:34 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 758 bytes |
| コンパイル時間 | 5,085 ms |
| コンパイル使用メモリ | 315,304 KB |
| 実行使用メモリ | 7,168 KB |
| 最終ジャッジ日時 | 2024-06-28 21:28:44 |
| 合計ジャッジ時間 | 7,582 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()
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][1] >> p[i][0];
}
sort(all(p));
vector<int> mx(n, 1);
rep(i,1,n){
mx[i] = mx[i-1];
auto itr = lower_bound(all(p), array<ll,2>{p[i][1]+1,0});
if(itr != p.begin()){
chmax(mx[i], mx[itr-p.begin() - 1] + 1);
}
}
cout << n - (mx[n-1])<< endl;
}