結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 05:04:56 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,080 bytes |
コンパイル時間 | 2,817 ms |
コンパイル使用メモリ | 78,392 KB |
実行使用メモリ | 74,756 KB |
最終ジャッジ日時 | 2024-12-22 08:43:43 |
合計ジャッジ時間 | 15,814 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 55 ms
50,024 KB |
testcase_03 | AC | 56 ms
50,304 KB |
testcase_04 | AC | 56 ms
49,752 KB |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | AC | 145 ms
56,892 KB |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | AC | 116 ms
55,028 KB |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | AC | 101 ms
53,880 KB |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | AC | 108 ms
54,960 KB |
testcase_35 | AC | 2,129 ms
74,248 KB |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | AC | 1,989 ms
74,432 KB |
testcase_39 | AC | 77 ms
53,056 KB |
testcase_40 | AC | 76 ms
50,620 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 <= x + 20; j++) { for (Point q : X[j]) { if (isIntersect(p, q)) { continue L; } } } for (int j = Math.max(0, y - 10); j <= 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(); } } }