Submission #2546371


Source Code Expand

#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

int n;
const int INF = 1e9;

struct Circle {
	int lb;
	int ub;

	bool operator< (const Circle &o) const {
		return ub == o.ub ? lb > o.lb : ub < o.ub;
	}
};

int main() {
	cin >> n;
	vector <Circle> circle(n);
	rep (i, n) {
		int x, r;
		cin >> x >> r;
		circle[i].lb = x - r;
		circle[i].ub = x + r;
	}

	rep (i, n) circle[i].lb *= -1;
	sort(circle.begin(), circle.end());

	vector <int> dp(n, INF);
	rep (i, n) {
		*lower_bound(dp.begin(), dp.end(), circle[i].lb) = circle[i].lb;
	}

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

Submission Info

Submission Time
Task K - ターゲット
User Masumi
Language C++14 (GCC 5.4.1)
Score 5
Code Size 739 Byte
Status AC
Exec Time 87 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 87 ms 1408 KB
01 AC 86 ms 1408 KB
02 AC 86 ms 1408 KB
03 AC 69 ms 1408 KB
04 AC 69 ms 1408 KB
05 AC 71 ms 1408 KB
06 AC 53 ms 1408 KB
07 AC 50 ms 1408 KB
90 AC 1 ms 256 KB
91 AC 1 ms 256 KB