Submission #4025125


Source Code Expand

#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define LOG(...) fprintf(stderr, __VA_ARGS__)
#define INF 200000001
using namespace std;

/*
n
x1 r1
...
xn rn

n 100000
xi 100000000
ri 100000000
 */
typedef pair<int,int> pp;
int n;
pp circ[100000];

int main(){
  cin >> n;
  REP(i,n){
    int x,r;
    cin >> x >> r;
    circ[i] = make_pair(x-r,x+r);
  }

  sort(circ, circ + n);
  reverse(circ, circ + n);  

  vector<int> dp(n,INF);
  REP(i,n){
    *lower_bound(dp.begin(), dp.end(), circ[i].second) = circ[i].second;
  }

  cout << (lower_bound(dp.begin(), dp.end(), INF) - dp.begin()) << endl;
  return 0;
}

Submission Info

Submission Time
Task K - ターゲット
User linuxojisan009
Language C++14 (GCC 5.4.1)
Score 5
Code Size 827 Byte
Status AC
Exec Time 86 ms
Memory 1408 KB

Judge Result

Set Name All
Score / Max Score 5 / 5
Status
AC × 10
Set Name Test Cases
All 00, 01, 02, 03, 04, 05, 06, 07, 90, 91
Case Name Status Exec Time Memory
00 AC 85 ms 1408 KB
01 AC 85 ms 1408 KB
02 AC 86 ms 1408 KB
03 AC 68 ms 1408 KB
04 AC 68 ms 1408 KB
05 AC 71 ms 1408 KB
06 AC 53 ms 1408 KB
07 AC 48 ms 1408 KB
90 AC 1 ms 256 KB
91 AC 1 ms 256 KB