#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ii pair<int,int>
#define ll long long
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define orta ((bas+son)>>1)
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define inf 2000000000
#define N 500005
#define MOD 1000000007
using namespace std;
static char stdinBuffer[1024];
static char* stdinDataEnd = stdinBuffer + sizeof (stdinBuffer);
static const char* stdinPos = stdinDataEnd;
void readAhead(size_t amount)
{
size_t remaining = stdinDataEnd - stdinPos;
if (remaining < amount) {
memmove(stdinBuffer, stdinPos, remaining);
size_t sz = fread(stdinBuffer + remaining, 1, sizeof (stdinBuffer) - remaining, stdin);
stdinPos = stdinBuffer;
stdinDataEnd = stdinBuffer + remaining + sz;
if (stdinDataEnd != stdinBuffer + sizeof (stdinBuffer))
*stdinDataEnd = 0;
}
}
int readInt()
{
readAhead(16);
int x = 0;
bool neg = false;
if (*stdinPos == '-') {
++stdinPos;
neg = true;
}
while (*stdinPos >= '0' && *stdinPos <= '9') {
x *= 10;
x += *stdinPos - '0';
++stdinPos;
}
return neg ? -x : x;
}
bitset<10000000> u;
int main() {
int n;
//scanf("%d",&n);
n=readInt();
vector<ii> a(n);
int cnt=n;
for(int i=0;i<n;i++) {
//scanf("%d %d",&a[i].st,&a[i].nd);
a[i].st=readInt();
a[i].nd=readInt();
}
int mn=inf;
for(int i=n-1;i>=0;i--) {
int val=a[i].st-a[i].nd;
if(mn<=val) {
cnt-=!u[i];
u[i]=1;
}
umin(mn,val);
}
int mx=-inf;
for(int i=0;i<n;i++) {
int val=a[i].st+a[i].nd;
if(mx>=val) {
cnt-=!u[i];
u[i]=1;
}
umax(mx,val);
}
printf("%d",cnt);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
218 ms |
77432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
225 ms |
79444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
218 ms |
77432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |