結果

問題 No.1137 Circles
ユーザー tnakao0123tnakao0123
提出日時 2020-07-31 00:34:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 905 bytes
コンパイル時間 745 ms
コンパイル使用メモリ 89,456 KB
実行使用メモリ 6,684 KB
最終ジャッジ日時 2023-09-18 09:24:03
合計ジャッジ時間 2,224 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
6,560 KB
testcase_01 AC 25 ms
6,520 KB
testcase_02 AC 5 ms
6,508 KB
testcase_03 AC 15 ms
6,560 KB
testcase_04 AC 19 ms
6,516 KB
testcase_05 AC 7 ms
6,684 KB
testcase_06 AC 21 ms
6,512 KB
testcase_07 AC 13 ms
6,560 KB
testcase_08 AC 23 ms
6,612 KB
testcase_09 AC 9 ms
6,576 KB
testcase_10 AC 14 ms
6,600 KB
testcase_11 AC 16 ms
6,544 KB
testcase_12 AC 28 ms
6,588 KB
testcase_13 AC 10 ms
6,680 KB
testcase_14 AC 27 ms
6,508 KB
testcase_15 AC 11 ms
6,504 KB
testcase_16 AC 16 ms
6,556 KB
testcase_17 AC 5 ms
6,592 KB
testcase_18 AC 22 ms
6,504 KB
testcase_19 AC 11 ms
6,552 KB
testcase_20 AC 9 ms
6,548 KB
testcase_21 AC 6 ms
6,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1137.cc:  No.1137 Circles - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int R = 200000 * 2;
const int M = R * 2 + 1;

/* typedef */

/* global variables */

int cs[M];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    int xi, ri;
    scanf("%d%d", &xi, &ri);
    xi *= 2, ri *= 2;
    cs[R + xi - ri + 1]++, cs[R + xi + ri]--;
  }

  int maxc = cs[0];
  for (int i = 1; i < M; i++) {
    cs[i] += cs[i - 1];
    if (maxc < cs[i]) maxc = cs[i];
  }

  printf("%d\n", maxc);


  return 0;
}
0