結果

問題 No.1137 Circles
ユーザー parsee1053parsee1053
提出日時 2020-09-22 00:01:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 762 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 74,824 KB
実行使用メモリ 7,764 KB
最終ジャッジ日時 2023-09-07 04:36:47
合計ジャッジ時間 2,591 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,328 KB
testcase_01 AC 51 ms
7,432 KB
testcase_02 AC 5 ms
6,168 KB
testcase_03 AC 27 ms
6,892 KB
testcase_04 AC 38 ms
7,024 KB
testcase_05 AC 11 ms
6,120 KB
testcase_06 AC 44 ms
7,108 KB
testcase_07 AC 23 ms
6,580 KB
testcase_08 AC 46 ms
7,108 KB
testcase_09 AC 16 ms
6,592 KB
testcase_10 AC 25 ms
6,676 KB
testcase_11 AC 28 ms
6,940 KB
testcase_12 AC 58 ms
7,764 KB
testcase_13 AC 17 ms
6,384 KB
testcase_14 AC 54 ms
7,396 KB
testcase_15 AC 20 ms
6,508 KB
testcase_16 AC 28 ms
6,700 KB
testcase_17 AC 8 ms
6,120 KB
testcase_18 AC 45 ms
7,116 KB
testcase_19 AC 18 ms
6,724 KB
testcase_20 AC 14 ms
6,412 KB
testcase_21 AC 5 ms
6,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int hoge = 200000;
  int n;
  cin >> n;
  vector<int> x(n), r(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> r[i];
    x[i] += hoge;
  }
  vector<ll> sum(n + 2 * hoge + 1);
  for (int i = 0; i < n; ++i) {
    sum[x[i] - r[i]]++;
    sum[x[i] + r[i]]--;
  }
  for (int i = 1; i <= n + 2 * hoge; ++i) {
    sum[i] += sum[i - 1];
  }
  ll ans = 0;
  for (int i = 0; i <= n + 2 * hoge; ++i) {
    ans = max(ans, sum[i]);
  }
  cout << ans << endl;
  return 0;
}
0