#include<bits/stdc++.h>
using namespace std;
#define int long long
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
inline int readInt()
{
int x = 0; char ch=getchar_unlocked(); bool st = 1;
while(ch < '0' || ch > '9'){if(ch=='-')st=0; ch=getchar_unlocked();}
while(ch>='0'&&ch<='9'){x = (x<<3)+(x<<1)+ch-'0';ch=getchar_unlocked();}
return st?x:-x;
}
vector<int> add(1e7+1, 0);
vector<int> sub(1e7+1, 0);
signed main()
{
fast();
int n = readInt();
for(int i = 1; i <= n; i++)
{
int x, y;
x = readInt();
y = readInt();
add[i] = x+y;
sub[i] = y-x;
}
for(int i = 2; i <= n; i++)
add[i] = max(add[i], add[i-1]);
for(int i = n-1; i >= 1; i--)
sub[i] = max(sub[i], sub[i+1]);
int ans = 0;
for(int i = 1; i <= n; i++)
ans+=(((i==1)||(add[i] > add[i+1]))&&((i==n)||(sub[i] > sub[i+1])));
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
315 ms |
156748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
156844 KB |
Output is correct |
2 |
Correct |
56 ms |
156860 KB |
Output is correct |
3 |
Incorrect |
63 ms |
156788 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
156844 KB |
Output is correct |
2 |
Correct |
56 ms |
156860 KB |
Output is correct |
3 |
Incorrect |
63 ms |
156788 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
156844 KB |
Output is correct |
2 |
Correct |
56 ms |
156860 KB |
Output is correct |
3 |
Incorrect |
63 ms |
156788 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
156844 KB |
Output is correct |
2 |
Correct |
56 ms |
156860 KB |
Output is correct |
3 |
Incorrect |
63 ms |
156788 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
323 ms |
156876 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
315 ms |
156748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |