diff --git a/01xxx/01863.cpp b/01xxx/01863.cpp new file mode 100644 index 00000000..880cc094 --- /dev/null +++ b/01xxx/01863.cpp @@ -0,0 +1,32 @@ +#include +#include +#include +#include +using namespace std; + +void solve(void) { + int n; cin >> n; + vector> v(n); + for (int i=0; i> v[i].first >> v[i].second; + sort(v.begin(), v.end()); + + int ans = 0; + stack s; + s.push(0); + for (int i=0; i v[i].second) s.pop(); + if (s.top() < v[i].second) ans++, s.push(v[i].second); + } + } + cout << ans; +} + +int main(void) { + ios::sync_with_stdio(false); + cin.tie(nullptr); + + solve(); + return 0; +} \ No newline at end of file