結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 05:32:32 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,817 bytes |
コンパイル時間 | 2,561 ms |
コンパイル使用メモリ | 78,824 KB |
実行使用メモリ | 73,484 KB |
最終ジャッジ日時 | 2024-12-22 08:46:10 |
合計ジャッジ時間 | 49,107 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,149 ms
63,652 KB |
testcase_01 | AC | 2,901 ms
63,616 KB |
testcase_02 | AC | 63 ms
49,784 KB |
testcase_03 | AC | 64 ms
50,028 KB |
testcase_04 | AC | 63 ms
50,220 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 1,394 ms
63,628 KB |
testcase_17 | AC | 2,251 ms
63,336 KB |
testcase_18 | AC | 2,282 ms
63,528 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 135 ms
52,568 KB |
testcase_23 | AC | 146 ms
55,284 KB |
testcase_24 | AC | 131 ms
54,568 KB |
testcase_25 | AC | 134 ms
55,312 KB |
testcase_26 | AC | 160 ms
55,856 KB |
testcase_27 | AC | 156 ms
55,212 KB |
testcase_28 | WA | - |
testcase_29 | AC | 150 ms
57,148 KB |
testcase_30 | AC | 149 ms
55,068 KB |
testcase_31 | AC | 137 ms
54,864 KB |
testcase_32 | AC | 170 ms
57,400 KB |
testcase_33 | WA | - |
testcase_34 | AC | 157 ms
55,652 KB |
testcase_35 | AC | 2,023 ms
73,484 KB |
testcase_36 | AC | 1,280 ms
70,048 KB |
testcase_37 | WA | - |
testcase_38 | AC | 1,996 ms
72,528 KB |
testcase_39 | AC | 120 ms
52,360 KB |
testcase_40 | WA | - |
ソースコード
import java.io.IOException; import java.util.InputMismatchException; import java.util.TreeSet; public class Main { boolean isIntersect(int x, int y, int a, int b) { return (x - a) * (x - a) + (y - b) * (y - b) < 400; } void run() { MyScanner sc = new MyScanner(); TreeSet<Integer>[] set = new TreeSet[20001]; for (int i = 0; i < 20001; i++) { set[i] = new TreeSet<Integer>(); } int n = sc.nextInt(); int ans = 0; L: for (int i = 0; i < n; i++) { int x = sc.nextInt(); int y = sc.nextInt(); for (int j = Math.max(0, x - 20); j <= Math.min(20000, x + 20); j++) { for (int k = Math.max(0, y - 10); k <= Math.min(20000, y + 20); k++) { if (!set[j].contains(k)) { continue; } if (isIntersect(x, y, j, k)) { continue L; } } } set[x].add(y); 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(); } } }