이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define pii pair<int, int>
#define f first
#define s second
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
bool covered[n] = {}; pii A[n]; int H = -1;
FOR(i, 0, n){
cin >> A[i].f >> A[i].s;
if (A[i].f + A[i].s <= H) covered[i] = 1; //covered by something before
else H = A[i].f + A[i].s;
}
H = 2e9;
for (int i = n - 1; ~i; i--){
if (A[i].f - A[i].s >= H) covered[i] = 1; //covered by something after
else H = A[i].f - A[i].s;
}
cout<<n - accumulate(covered, covered + n, 0)<<endl;
}
# | 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... |