結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 17:02:49 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 1,307 ms / 5,000 ms |
コード長 | 3,412 bytes |
コンパイル時間 | 2,884 ms |
コンパイル使用メモリ | 79,960 KB |
実行使用メモリ | 74,088 KB |
最終ジャッジ日時 | 2024-12-22 08:52:31 |
合計ジャッジ時間 | 26,612 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 931 ms
73,012 KB |
testcase_01 | AC | 659 ms
63,468 KB |
testcase_02 | AC | 64 ms
49,940 KB |
testcase_03 | AC | 67 ms
49,836 KB |
testcase_04 | AC | 68 ms
49,828 KB |
testcase_05 | AC | 188 ms
56,964 KB |
testcase_06 | AC | 852 ms
64,208 KB |
testcase_07 | AC | 1,172 ms
72,020 KB |
testcase_08 | AC | 1,307 ms
72,904 KB |
testcase_09 | AC | 1,016 ms
74,088 KB |
testcase_10 | AC | 408 ms
61,080 KB |
testcase_11 | AC | 772 ms
71,032 KB |
testcase_12 | AC | 511 ms
61,680 KB |
testcase_13 | AC | 526 ms
68,420 KB |
testcase_14 | AC | 211 ms
58,092 KB |
testcase_15 | AC | 688 ms
64,016 KB |
testcase_16 | AC | 987 ms
71,908 KB |
testcase_17 | AC | 1,035 ms
71,652 KB |
testcase_18 | AC | 961 ms
71,412 KB |
testcase_19 | AC | 866 ms
72,076 KB |
testcase_20 | AC | 1,203 ms
73,084 KB |
testcase_21 | AC | 592 ms
64,144 KB |
testcase_22 | AC | 141 ms
54,912 KB |
testcase_23 | AC | 161 ms
54,644 KB |
testcase_24 | AC | 113 ms
53,292 KB |
testcase_25 | AC | 116 ms
53,436 KB |
testcase_26 | AC | 150 ms
55,072 KB |
testcase_27 | AC | 157 ms
54,736 KB |
testcase_28 | AC | 114 ms
51,296 KB |
testcase_29 | AC | 119 ms
53,472 KB |
testcase_30 | AC | 134 ms
54,152 KB |
testcase_31 | AC | 113 ms
53,432 KB |
testcase_32 | AC | 129 ms
54,332 KB |
testcase_33 | AC | 114 ms
53,860 KB |
testcase_34 | AC | 131 ms
54,204 KB |
testcase_35 | AC | 933 ms
72,636 KB |
testcase_36 | AC | 1,025 ms
72,344 KB |
testcase_37 | AC | 848 ms
64,400 KB |
testcase_38 | AC | 953 ms
71,460 KB |
testcase_39 | AC | 91 ms
52,684 KB |
testcase_40 | AC | 93 ms
50,568 KB |
ソースコード
import java.io.IOException; import java.util.ArrayList; import java.util.InputMismatchException; 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(); ArrayList<Point>[] X = new ArrayList[20001]; ArrayList<Point>[] Y = new ArrayList[20001]; for (int i = 0; i < 20001; i++) { X[i] = new ArrayList<Point>(); Y[i] = new ArrayList<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); int maxY = Math.min(20000, y + 19); for (int j = Math.max(0, y - 19); j <= maxY; j++) { for (Point q : Y[j]) { if (isIntersect(p, q)) { continue L; } // if (p.x < q.x && !isIntersect(p, q)) { // break; // } } } int maxX = Math.min(20000, x + 19); for (int j = Math.max(0, x - 19); j <= maxX; j++) { for (Point q : X[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(); } } }