# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810706 | _martynas | Advertisement 2 (JOI23_ho_t2) | C++11 | 373 ms | 18184 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
using pii = pair<int, int>;
const int mxn = 5e5+5;
int n;
int X[mxn], E[mxn];
int main() {
cin >> n;
for(int i = 0; i < n; i++) cin >> X[i] >> E[i];
vector<pii> A;
for(int i = 0; i < n; i++) {
A.pb({X[i]-E[i], -(X[i]+E[i])});
}
sort(all(A));
int mxr = -2e9-1;
int cnt = 0;
for(auto p : A) {
int l = p.fi, r = -p.se;
if(mxr >= r) continue;;
cnt++, mxr = r;
}
cout << cnt << "\n";
return 0;
}
Compilation message (stderr)
# | 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... |