結果
問題 | No.202 1円玉投げ |
ユーザー | fujisu |
提出日時 | 2015-05-09 05:32:32 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,817 bytes |
コンパイル時間 | 2,126 ms |
コンパイル使用メモリ | 75,184 KB |
実行使用メモリ | 71,284 KB |
最終ジャッジ日時 | 2023-08-23 22:36:04 |
合計ジャッジ時間 | 41,869 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,571 ms
63,252 KB |
testcase_01 | AC | 2,343 ms
63,476 KB |
testcase_02 | AC | 49 ms
49,536 KB |
testcase_03 | AC | 49 ms
49,256 KB |
testcase_04 | AC | 51 ms
49,296 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,120 ms
63,184 KB |
testcase_17 | AC | 1,775 ms
63,292 KB |
testcase_18 | AC | 1,831 ms
63,204 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 116 ms
52,508 KB |
testcase_23 | AC | 126 ms
55,744 KB |
testcase_24 | AC | 102 ms
54,644 KB |
testcase_25 | AC | 106 ms
55,368 KB |
testcase_26 | AC | 120 ms
55,232 KB |
testcase_27 | AC | 121 ms
55,852 KB |
testcase_28 | WA | - |
testcase_29 | AC | 119 ms
55,240 KB |
testcase_30 | AC | 137 ms
55,664 KB |
testcase_31 | AC | 110 ms
54,612 KB |
testcase_32 | AC | 147 ms
55,732 KB |
testcase_33 | WA | - |
testcase_34 | AC | 129 ms
55,664 KB |
testcase_35 | AC | 1,635 ms
63,392 KB |
testcase_36 | AC | 1,553 ms
63,124 KB |
testcase_37 | WA | - |
testcase_38 | AC | 1,683 ms
61,376 KB |
testcase_39 | AC | 93 ms
52,844 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(); } } }