Submission #1174445

#TimeUsernameProblemLanguageResultExecution timeMemory
1174445TsaganaAdvertisement 2 (JOI23_ho_t2)C++20
100 / 100
103 ms8264 KiB
#include<bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second

using namespace std;

void solve () {
	int n;
	cin >> n;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		a[i] = {y - x, y + x};
	}
	sort(rall(a));
	int ans = 0, pre = INT_MIN;
	for (auto i: a) {
		ans += i.S > pre;
		pre = max(pre, i.S);
	}
	cout << ans << "\n";
}
signed main() {IOS solve(); return 0;}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...