#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#define int long long
using namespace std;
//using namespace __gnu_pbds;
constexpr int maxn = 1e7 + 9;
int a[maxn];
void solve(){
int n;
cin >> n;
int cnt = 0;
/*tree<
int,
null_type,
less_equal<int>,
rb_tree_tag,
tree_order_statistics_node_update> s;*/
for(int i = 1; i <= n; i++) {
int x, y;
cin >> x >> y;
a[i] = x - y;
}
int mn = INT_MAX;
for(int i = n; i >= 1; i--) {
if(mn > a[i]) {
cnt++;
mn = a[i];
}
}
cout << cnt;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int tt = 1;
//cin >> tt;
while(tt--) {
solve();
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |