結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 06:39:30 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,346 bytes |
コンパイル時間 | 2,137 ms |
コンパイル使用メモリ | 75,880 KB |
実行使用メモリ | 87,432 KB |
最終ジャッジ日時 | 2023-08-23 22:40:54 |
合計ジャッジ時間 | 32,112 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,229 ms
85,464 KB |
testcase_01 | AC | 1,574 ms
86,304 KB |
testcase_02 | AC | 53 ms
52,304 KB |
testcase_03 | AC | 53 ms
52,748 KB |
testcase_04 | AC | 52 ms
52,428 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 1,506 ms
84,924 KB |
testcase_17 | AC | 1,491 ms
85,304 KB |
testcase_18 | AC | 1,399 ms
87,236 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 154 ms
59,108 KB |
testcase_23 | AC | 158 ms
58,604 KB |
testcase_24 | AC | 91 ms
54,216 KB |
testcase_25 | AC | 94 ms
56,692 KB |
testcase_26 | AC | 151 ms
58,860 KB |
testcase_27 | AC | 150 ms
58,856 KB |
testcase_28 | AC | 107 ms
56,364 KB |
testcase_29 | AC | 103 ms
56,660 KB |
testcase_30 | AC | 112 ms
56,112 KB |
testcase_31 | AC | 99 ms
56,540 KB |
testcase_32 | AC | 108 ms
56,740 KB |
testcase_33 | WA | - |
testcase_34 | AC | 120 ms
57,568 KB |
testcase_35 | AC | 1,751 ms
87,432 KB |
testcase_36 | AC | 1,272 ms
85,436 KB |
testcase_37 | WA | - |
testcase_38 | AC | 1,624 ms
82,920 KB |
testcase_39 | AC | 88 ms
53,048 KB |
testcase_40 | AC | 72 ms
53,124 KB |
ソースコード
import java.io.IOException; import java.util.InputMismatchException; import java.util.TreeSet; public class Main { class Point implements Comparable<Point> { int x, y; Point(int x, int y) { this.x = x; this.y = y; } @Override public int compareTo(Point o) { return this.x != o.x ? this.x - o.x : this.y - o.y; } } boolean isIntersect(Point a, Point b) { return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) < 400; } void run() { MyScanner sc = new MyScanner(); TreeSet<Point>[] X = new TreeSet[20001]; TreeSet<Point>[] Y = new TreeSet[20001]; for (int i = 0; i < 20001; i++) { X[i] = new TreeSet<Point>(); Y[i] = new TreeSet<Point>(); } int n = sc.nextInt(); int ans = 0; L: for (int i = 0; i < n; i++) { int x = sc.nextInt(); int y = sc.nextInt(); Point p = new Point(x, y); for (int j = Math.max(0, x - 19); j <= Math.min(20000, x + 19); j++) { for (Point q : X[j]) { if (isIntersect(p, q)) { continue L; } if (p.x < q.x && !isIntersect(p, q)) { break; } } } for (int j = Math.max(0, y - 19); j <= Math.min(20000, y + 19); j++) { for (Point q : Y[j]) { if (isIntersect(p, q)) { continue L; } if (p.y < q.y && !isIntersect(p, q)) { break; } } } X[x].add(p); Y[y].add(p); 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(); } } }