結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 05:38:33 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 3,331 ms / 5,000 ms |
コード長 | 2,817 bytes |
コンパイル時間 | 2,259 ms |
コンパイル使用メモリ | 75,440 KB |
実行使用メモリ | 65,196 KB |
最終ジャッジ日時 | 2023-08-23 22:37:42 |
合計ジャッジ時間 | 51,046 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,027 ms
63,100 KB |
testcase_01 | AC | 2,905 ms
63,468 KB |
testcase_02 | AC | 51 ms
49,592 KB |
testcase_03 | AC | 51 ms
49,376 KB |
testcase_04 | AC | 51 ms
49,388 KB |
testcase_05 | AC | 291 ms
58,044 KB |
testcase_06 | AC | 2,716 ms
61,108 KB |
testcase_07 | AC | 3,205 ms
61,716 KB |
testcase_08 | AC | 3,331 ms
61,228 KB |
testcase_09 | AC | 1,518 ms
61,592 KB |
testcase_10 | AC | 667 ms
59,700 KB |
testcase_11 | AC | 1,290 ms
59,572 KB |
testcase_12 | AC | 1,205 ms
59,872 KB |
testcase_13 | AC | 729 ms
59,480 KB |
testcase_14 | AC | 322 ms
57,272 KB |
testcase_15 | AC | 1,529 ms
61,520 KB |
testcase_16 | AC | 1,530 ms
63,404 KB |
testcase_17 | AC | 2,460 ms
65,196 KB |
testcase_18 | AC | 2,331 ms
63,148 KB |
testcase_19 | AC | 1,367 ms
59,292 KB |
testcase_20 | AC | 2,309 ms
61,884 KB |
testcase_21 | AC | 1,353 ms
59,284 KB |
testcase_22 | AC | 104 ms
53,164 KB |
testcase_23 | AC | 117 ms
55,576 KB |
testcase_24 | AC | 111 ms
55,012 KB |
testcase_25 | AC | 123 ms
55,668 KB |
testcase_26 | AC | 116 ms
55,572 KB |
testcase_27 | AC | 120 ms
55,616 KB |
testcase_28 | AC | 120 ms
55,380 KB |
testcase_29 | AC | 121 ms
55,156 KB |
testcase_30 | AC | 125 ms
55,148 KB |
testcase_31 | AC | 122 ms
55,480 KB |
testcase_32 | AC | 154 ms
55,472 KB |
testcase_33 | AC | 129 ms
55,424 KB |
testcase_34 | AC | 128 ms
55,564 KB |
testcase_35 | AC | 1,894 ms
63,268 KB |
testcase_36 | AC | 1,822 ms
63,224 KB |
testcase_37 | AC | 3,267 ms
63,504 KB |
testcase_38 | AC | 2,141 ms
63,224 KB |
testcase_39 | AC | 95 ms
53,028 KB |
testcase_40 | AC | 89 ms
52,712 KB |
ソースコード
import java.io.IOException; import java.util.InputMismatchException; import java.util.TreeSet; public class Main { boolean isIntersect(int x, int y, int a, int b) { return (x - a) * (x - a) + (y - b) * (y - b) < 400; } void run() { MyScanner sc = new MyScanner(); TreeSet<Integer>[] set = new TreeSet[20001]; for (int i = 0; i < 20001; i++) { set[i] = new TreeSet<Integer>(); } int n = sc.nextInt(); int ans = 0; L: for (int i = 0; i < n; i++) { int x = sc.nextInt(); int y = sc.nextInt(); for (int j = Math.max(0, x - 20); j <= Math.min(20000, x + 20); j++) { for (int k = Math.max(0, y - 20); k <= Math.min(20000, y + 20); k++) { if (!set[j].contains(k)) { continue; } if (isIntersect(x, y, j, k)) { continue L; } } } set[x].add(y); ans++; } System.out.println(ans); } public static void main(String[] args) { new Main().run(); } public void mapDebug(int[][] a) { System.out.println("--------map display---------"); for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[i].length; j++) { System.out.printf("%3d ", a[i][j]); } System.out.println(); } System.out.println("----------------------------" + '\n'); } class MyScanner { int read() { try { return System.in.read(); } catch (IOException e) { throw new InputMismatchException(); } } boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } boolean isEndline(int c) { return c == '\n' || c == '\r' || c == -1; } int nextInt() { return Integer.parseInt(next()); } int[] nextIntArray(int n) { int[] array = new int[n]; for (int i = 0; i < n; i++) array[i] = nextInt(); return array; } long nextLong() { return Long.parseLong(next()); } long[] nextLongArray(int n) { long[] array = new long[n]; for (int i = 0; i < n; i++) array[i] = nextLong(); return array; } double nextDouble() { return Double.parseDouble(next()); } double[] nextDoubleArray(int n) { double[] array = new double[n]; for (int i = 0; i < n; i++) array[i] = nextDouble(); return array; } String next() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } String[] nextStringArray(int n) { String[] array = new String[n]; for (int i = 0; i < n; i++) array[i] = next(); return array; } String nextLine() { int c = read(); while (isEndline(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isEndline(c)); return res.toString(); } } }