結果
| 問題 |
No.2796 Small Matryoshka
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-28 22:39:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 589 bytes |
| コンパイル時間 | 2,343 ms |
| コンパイル使用メモリ | 197,752 KB |
| 最終ジャッジ日時 | 2025-02-22 01:17:03 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 11 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/fenwicktree>
using namespace std;
using ll=long long;
constexpr int MOD=998244353;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define replr(i,l,r) for(int i=(l);i<(int)(r);i++)
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
vector A(N,array<int,2>());
for(auto &i:A)cin>>i[0]>>i[1];
sort(A.begin(),A.end(),[](array<int,2>& a,array<int,2>& b){
return a[1]<b[1];
});
int ans=0,r=0;
for(int i=0;i<N;i++){
if(A[i][0]>=r){
r=A[i][1];
}else{
ans+=1;
}
}
cout<<ans<<'\n';
}