結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 05:32:32 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,817 bytes |
コンパイル時間 | 2,345 ms |
コンパイル使用メモリ | 78,724 KB |
実行使用メモリ | 62,616 KB |
最終ジャッジ日時 | 2024-06-01 20:02:53 |
合計ジャッジ時間 | 42,048 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,026 ms
52,176 KB |
testcase_01 | AC | 2,410 ms
52,716 KB |
testcase_02 | AC | 56 ms
38,176 KB |
testcase_03 | AC | 55 ms
38,096 KB |
testcase_04 | AC | 56 ms
38,136 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,152 ms
52,472 KB |
testcase_17 | AC | 1,957 ms
62,376 KB |
testcase_18 | AC | 2,087 ms
52,684 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 123 ms
40,916 KB |
testcase_23 | AC | 130 ms
45,580 KB |
testcase_24 | AC | 123 ms
43,804 KB |
testcase_25 | AC | 131 ms
44,552 KB |
testcase_26 | AC | 119 ms
45,132 KB |
testcase_27 | AC | 123 ms
44,800 KB |
testcase_28 | WA | - |
testcase_29 | AC | 129 ms
44,980 KB |
testcase_30 | AC | 143 ms
45,092 KB |
testcase_31 | AC | 127 ms
45,204 KB |
testcase_32 | AC | 142 ms
44,928 KB |
testcase_33 | WA | - |
testcase_34 | AC | 146 ms
45,232 KB |
testcase_35 | AC | 1,638 ms
62,616 KB |
testcase_36 | AC | 1,054 ms
60,664 KB |
testcase_37 | WA | - |
testcase_38 | AC | 1,761 ms
52,552 KB |
testcase_39 | AC | 109 ms
40,248 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(); } } }