結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 05:04:56 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,080 bytes |
コンパイル時間 | 2,605 ms |
コンパイル使用メモリ | 75,416 KB |
実行使用メモリ | 74,104 KB |
最終ジャッジ日時 | 2023-08-23 22:34:05 |
合計ジャッジ時間 | 17,958 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 51 ms
49,612 KB |
testcase_03 | AC | 50 ms
49,472 KB |
testcase_04 | AC | 51 ms
49,372 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 | 132 ms
57,108 KB |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | AC | 120 ms
55,540 KB |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | AC | 90 ms
54,428 KB |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | AC | 101 ms
54,420 KB |
testcase_35 | AC | 2,747 ms
72,796 KB |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | AC | 2,783 ms
73,464 KB |
testcase_39 | AC | 73 ms
53,712 KB |
testcase_40 | AC | 76 ms
53,460 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(); } } }