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>
#define ll long long
#define ull unsigned long long
#define lsb(x) (x & (-x))
#define uint unsigned int
using namespace std;
const int MAXN = (int) 1e7;
int x[MAXN + 1], y[MAXN + 1];
int stk[MAXN + 1];
int main() {
#ifdef HOME
ifstream cin("A.in");
//ofstream cout("A.out");
#endif
int i, n;
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n;
for(i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
int sz = 0;
for(i = 1; i <= n; i++) {
while(sz > 0 && x[i] - x[stk[sz]] <= y[i] - y[stk[sz]]) {
sz--;
}
stk[++sz] = i;
}
cout << sz;
return 0;
}
# | 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... |