結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 05:17:17 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 2,586 ms / 5,000 ms |
コード長 | 3,311 bytes |
コンパイル時間 | 2,574 ms |
コンパイル使用メモリ | 80,240 KB |
実行使用メモリ | 86,932 KB |
最終ジャッジ日時 | 2024-06-01 20:03:34 |
合計ジャッジ時間 | 35,157 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,718 ms
86,660 KB |
testcase_01 | AC | 1,400 ms
83,836 KB |
testcase_02 | AC | 59 ms
52,456 KB |
testcase_03 | AC | 61 ms
52,256 KB |
testcase_04 | AC | 61 ms
52,380 KB |
testcase_05 | AC | 197 ms
60,880 KB |
testcase_06 | AC | 1,194 ms
77,288 KB |
testcase_07 | AC | 832 ms
75,436 KB |
testcase_08 | AC | 1,245 ms
83,632 KB |
testcase_09 | AC | 906 ms
75,676 KB |
testcase_10 | AC | 419 ms
71,276 KB |
testcase_11 | AC | 842 ms
75,680 KB |
testcase_12 | AC | 795 ms
75,700 KB |
testcase_13 | AC | 484 ms
74,472 KB |
testcase_14 | AC | 196 ms
61,888 KB |
testcase_15 | AC | 922 ms
75,728 KB |
testcase_16 | AC | 1,843 ms
84,812 KB |
testcase_17 | AC | 1,991 ms
80,432 KB |
testcase_18 | AC | 1,737 ms
85,104 KB |
testcase_19 | AC | 837 ms
75,608 KB |
testcase_20 | AC | 1,201 ms
77,600 KB |
testcase_21 | AC | 785 ms
75,592 KB |
testcase_22 | AC | 164 ms
59,112 KB |
testcase_23 | AC | 163 ms
58,136 KB |
testcase_24 | AC | 96 ms
53,832 KB |
testcase_25 | AC | 117 ms
56,676 KB |
testcase_26 | AC | 161 ms
58,540 KB |
testcase_27 | AC | 163 ms
57,948 KB |
testcase_28 | AC | 109 ms
56,420 KB |
testcase_29 | AC | 108 ms
56,712 KB |
testcase_30 | AC | 124 ms
56,372 KB |
testcase_31 | AC | 109 ms
53,852 KB |
testcase_32 | AC | 114 ms
56,632 KB |
testcase_33 | AC | 109 ms
56,600 KB |
testcase_34 | AC | 130 ms
57,508 KB |
testcase_35 | AC | 2,586 ms
86,516 KB |
testcase_36 | AC | 1,885 ms
73,868 KB |
testcase_37 | AC | 1,283 ms
81,356 KB |
testcase_38 | AC | 2,525 ms
86,932 KB |
testcase_39 | AC | 98 ms
53,612 KB |
testcase_40 | AC | 86 ms
53,600 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 - 20); j <= Math.min(20000, x + 20); j++) { for (Point q : X[j]) { if (isIntersect(p, q)) { continue L; } if (20 < q.x - p.x) { break; } } } for (int j = Math.max(0, y - 10); j <= Math.min(20000, y + 20); j++) { for (Point q : Y[j]) { if (isIntersect(p, q)) { continue L; } if (20 < q.y - p.y) { 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(); } } }