結果

問題 No.1137 Circles
ユーザー forest3forest3
提出日時 2020-08-05 10:48:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 1,462 ms
コンパイル使用メモリ 167,300 KB
実行使用メモリ 4,712 KB
最終ジャッジ日時 2023-10-14 08:08:32
合計ジャッジ時間 3,372 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 48 ms
4,480 KB
testcase_02 AC 3 ms
4,352 KB
testcase_03 AC 24 ms
4,348 KB
testcase_04 AC 35 ms
4,352 KB
testcase_05 AC 8 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 20 ms
4,352 KB
testcase_08 AC 42 ms
4,352 KB
testcase_09 WA -
testcase_10 AC 22 ms
4,348 KB
testcase_11 AC 26 ms
4,352 KB
testcase_12 AC 53 ms
4,500 KB
testcase_13 AC 15 ms
4,348 KB
testcase_14 AC 51 ms
4,712 KB
testcase_15 AC 17 ms
4,352 KB
testcase_16 WA -
testcase_17 AC 5 ms
4,352 KB
testcase_18 WA -
testcase_19 AC 16 ms
4,352 KB
testcase_20 AC 12 ms
4,352 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> x( N );
	vector<int> r( N );
	for( int i = 0; i < N; i++ ) {
		cin >> x[i] >> r[i];
	}

	const int n = 100000;
	vector<int> a( 2 * n + 2 );
	for( int i = 0; i < N; i++ ) {
		int l = max( 0, x[i] - r[i] + n );
		int rr = x[i] + r[i] + 1 + n;
		a[l]++;
		if( rr < 2 * n + 2 ) a[rr]--;
	}

	for( int i = 0; i < 2 * n + 2 - 1; i++ ) {
		a[i + 1] += a[i];
	}
	int ans = 0;
	for( int i = 0; i < 2 * n + 2; i++ ) {
		ans = max( ans, a[i] );
	}

	cout << ans << endl;
}
0