結果
問題 | No.1137 Circles |
ユーザー | tenten |
提出日時 | 2022-10-04 15:39:14 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 621 ms / 2,000 ms |
コード長 | 1,449 bytes |
コンパイル時間 | 2,694 ms |
コンパイル使用メモリ | 75,468 KB |
実行使用メモリ | 64,972 KB |
最終ジャッジ日時 | 2023-08-28 17:50:52 |
合計ジャッジ時間 | 13,085 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 46 ms
49,436 KB |
testcase_01 | AC | 580 ms
64,880 KB |
testcase_02 | AC | 118 ms
53,608 KB |
testcase_03 | AC | 408 ms
60,836 KB |
testcase_04 | AC | 501 ms
63,316 KB |
testcase_05 | AC | 193 ms
55,684 KB |
testcase_06 | AC | 534 ms
63,084 KB |
testcase_07 | AC | 342 ms
60,688 KB |
testcase_08 | AC | 538 ms
62,844 KB |
testcase_09 | AC | 277 ms
60,960 KB |
testcase_10 | AC | 364 ms
60,784 KB |
testcase_11 | AC | 424 ms
60,656 KB |
testcase_12 | AC | 621 ms
64,888 KB |
testcase_13 | AC | 284 ms
61,100 KB |
testcase_14 | AC | 595 ms
64,972 KB |
testcase_15 | AC | 300 ms
61,252 KB |
testcase_16 | AC | 413 ms
60,700 KB |
testcase_17 | AC | 139 ms
55,688 KB |
testcase_18 | AC | 511 ms
62,788 KB |
testcase_19 | AC | 296 ms
60,532 KB |
testcase_20 | AC | 241 ms
58,120 KB |
testcase_21 | AC | 45 ms
49,496 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); TreeMap<Integer, Integer> counts = new TreeMap<>(); for (int i = 0; i < n; i++) { int x = sc.nextInt(); int r = sc.nextInt(); counts.put(x - r, counts.getOrDefault(x - r, 0) + 1); counts.put(x + r, counts.getOrDefault(x + r, 0) - 1); } int current = 0; int max = 0; for (int x : counts.keySet()) { current += counts.get(x); max = Math.max(max, current); } System.out.println(max); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }