結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 05:38:33 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 3,794 ms / 5,000 ms |
コード長 | 2,817 bytes |
コンパイル時間 | 2,755 ms |
コンパイル使用メモリ | 78,768 KB |
実行使用メモリ | 63,760 KB |
最終ジャッジ日時 | 2024-12-22 08:48:01 |
合計ジャッジ時間 | 56,136 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,512 ms
63,572 KB |
testcase_01 | AC | 2,523 ms
63,640 KB |
testcase_02 | AC | 64 ms
50,304 KB |
testcase_03 | AC | 63 ms
50,148 KB |
testcase_04 | AC | 65 ms
50,072 KB |
testcase_05 | AC | 358 ms
57,644 KB |
testcase_06 | AC | 3,266 ms
61,836 KB |
testcase_07 | AC | 3,789 ms
61,800 KB |
testcase_08 | AC | 3,794 ms
61,752 KB |
testcase_09 | AC | 1,850 ms
62,144 KB |
testcase_10 | AC | 744 ms
59,352 KB |
testcase_11 | AC | 1,489 ms
59,480 KB |
testcase_12 | AC | 1,383 ms
60,220 KB |
testcase_13 | AC | 796 ms
59,592 KB |
testcase_14 | AC | 356 ms
57,716 KB |
testcase_15 | AC | 1,809 ms
61,484 KB |
testcase_16 | AC | 1,700 ms
63,572 KB |
testcase_17 | AC | 2,440 ms
63,516 KB |
testcase_18 | AC | 2,447 ms
63,552 KB |
testcase_19 | AC | 1,553 ms
59,440 KB |
testcase_20 | AC | 2,870 ms
61,668 KB |
testcase_21 | AC | 1,570 ms
60,456 KB |
testcase_22 | AC | 140 ms
52,632 KB |
testcase_23 | AC | 146 ms
55,588 KB |
testcase_24 | AC | 136 ms
55,204 KB |
testcase_25 | AC | 148 ms
55,784 KB |
testcase_26 | AC | 151 ms
55,580 KB |
testcase_27 | AC | 154 ms
55,620 KB |
testcase_28 | AC | 151 ms
55,260 KB |
testcase_29 | AC | 145 ms
55,540 KB |
testcase_30 | AC | 158 ms
55,164 KB |
testcase_31 | AC | 143 ms
55,232 KB |
testcase_32 | AC | 175 ms
55,220 KB |
testcase_33 | AC | 161 ms
55,404 KB |
testcase_34 | AC | 165 ms
55,320 KB |
testcase_35 | AC | 2,544 ms
63,584 KB |
testcase_36 | AC | 1,194 ms
63,232 KB |
testcase_37 | AC | 3,568 ms
63,760 KB |
testcase_38 | AC | 2,299 ms
63,540 KB |
testcase_39 | AC | 131 ms
52,436 KB |
testcase_40 | AC | 117 ms
51,988 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(); } } }