結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 05:09:27 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 3,023 ms / 5,000 ms |
コード長 | 3,114 bytes |
コンパイル時間 | 2,434 ms |
コンパイル使用メモリ | 78,548 KB |
実行使用メモリ | 75,960 KB |
最終ジャッジ日時 | 2024-12-22 08:45:14 |
合計ジャッジ時間 | 34,014 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,418 ms
74,460 KB |
testcase_01 | AC | 871 ms
74,204 KB |
testcase_02 | AC | 66 ms
49,868 KB |
testcase_03 | AC | 65 ms
50,176 KB |
testcase_04 | AC | 66 ms
50,200 KB |
testcase_05 | AC | 186 ms
58,232 KB |
testcase_06 | AC | 942 ms
72,716 KB |
testcase_07 | AC | 977 ms
72,336 KB |
testcase_08 | AC | 982 ms
75,960 KB |
testcase_09 | AC | 809 ms
71,588 KB |
testcase_10 | AC | 442 ms
68,532 KB |
testcase_11 | AC | 705 ms
71,316 KB |
testcase_12 | AC | 760 ms
70,936 KB |
testcase_13 | AC | 500 ms
69,720 KB |
testcase_14 | AC | 198 ms
59,212 KB |
testcase_15 | AC | 801 ms
71,716 KB |
testcase_16 | AC | 1,644 ms
72,144 KB |
testcase_17 | AC | 1,644 ms
74,248 KB |
testcase_18 | AC | 1,995 ms
72,776 KB |
testcase_19 | AC | 766 ms
71,504 KB |
testcase_20 | AC | 1,040 ms
74,272 KB |
testcase_21 | AC | 786 ms
71,536 KB |
testcase_22 | AC | 158 ms
56,196 KB |
testcase_23 | AC | 155 ms
55,468 KB |
testcase_24 | AC | 117 ms
53,560 KB |
testcase_25 | AC | 122 ms
53,692 KB |
testcase_26 | AC | 144 ms
55,332 KB |
testcase_27 | AC | 160 ms
55,524 KB |
testcase_28 | AC | 127 ms
53,864 KB |
testcase_29 | AC | 126 ms
54,200 KB |
testcase_30 | AC | 121 ms
54,516 KB |
testcase_31 | AC | 116 ms
53,688 KB |
testcase_32 | AC | 126 ms
54,788 KB |
testcase_33 | AC | 117 ms
53,792 KB |
testcase_34 | AC | 124 ms
54,320 KB |
testcase_35 | AC | 3,023 ms
72,416 KB |
testcase_36 | AC | 1,805 ms
64,416 KB |
testcase_37 | AC | 1,193 ms
74,852 KB |
testcase_38 | AC | 2,811 ms
74,676 KB |
testcase_39 | AC | 90 ms
53,404 KB |
testcase_40 | AC | 93 ms
50,636 KB |
ソースコード
import java.io.IOException; import java.util.InputMismatchException; import java.util.LinkedList; import java.util.List; public class Main { class Point { int x, y; Point(int x, int y) { this.x = x; this.y = 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(); List<Point>[] X = new LinkedList[20001]; List<Point>[] Y = new LinkedList[20001]; for (int i = 0; i < 20001; i++) { X[i] = new LinkedList<Point>(); Y[i] = new LinkedList<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; } } } 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; } } } 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(); } } }