結果
問題 | No.202 1円玉投げ |
ユーザー |
![]() |
提出日時 | 2015-05-09 05:38:33 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 2,991 ms / 5,000 ms |
コード長 | 2,817 bytes |
コンパイル時間 | 2,781 ms |
コンパイル使用メモリ | 78,604 KB |
実行使用メモリ | 62,344 KB |
最終ジャッジ日時 | 2024-06-01 20:04:28 |
合計ジャッジ時間 | 46,262 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,203 ms
52,188 KB |
testcase_01 | AC | 2,538 ms
52,808 KB |
testcase_02 | AC | 53 ms
38,224 KB |
testcase_03 | AC | 51 ms
38,368 KB |
testcase_04 | AC | 52 ms
38,444 KB |
testcase_05 | AC | 275 ms
48,240 KB |
testcase_06 | AC | 2,604 ms
52,196 KB |
testcase_07 | AC | 2,991 ms
51,836 KB |
testcase_08 | AC | 2,974 ms
51,700 KB |
testcase_09 | AC | 1,504 ms
49,764 KB |
testcase_10 | AC | 629 ms
48,484 KB |
testcase_11 | AC | 1,232 ms
49,568 KB |
testcase_12 | AC | 1,172 ms
57,312 KB |
testcase_13 | AC | 608 ms
48,756 KB |
testcase_14 | AC | 300 ms
47,832 KB |
testcase_15 | AC | 1,527 ms
50,732 KB |
testcase_16 | AC | 1,432 ms
52,608 KB |
testcase_17 | AC | 2,293 ms
52,644 KB |
testcase_18 | AC | 2,037 ms
62,344 KB |
testcase_19 | AC | 1,338 ms
49,544 KB |
testcase_20 | AC | 2,281 ms
50,860 KB |
testcase_21 | AC | 1,356 ms
50,688 KB |
testcase_22 | AC | 120 ms
40,884 KB |
testcase_23 | AC | 119 ms
45,264 KB |
testcase_24 | AC | 119 ms
44,888 KB |
testcase_25 | AC | 124 ms
45,360 KB |
testcase_26 | AC | 124 ms
45,416 KB |
testcase_27 | AC | 118 ms
44,448 KB |
testcase_28 | AC | 118 ms
45,212 KB |
testcase_29 | AC | 130 ms
45,400 KB |
testcase_30 | AC | 136 ms
45,204 KB |
testcase_31 | AC | 118 ms
45,328 KB |
testcase_32 | AC | 155 ms
45,644 KB |
testcase_33 | AC | 137 ms
45,056 KB |
testcase_34 | AC | 132 ms
45,084 KB |
testcase_35 | AC | 2,121 ms
52,776 KB |
testcase_36 | AC | 1,032 ms
51,944 KB |
testcase_37 | AC | 2,875 ms
52,392 KB |
testcase_38 | AC | 2,177 ms
52,776 KB |
testcase_39 | AC | 111 ms
40,924 KB |
testcase_40 | AC | 101 ms
40,056 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(); } } }