結果
問題 | No.202 1円玉投げ |
ユーザー | tenten |
提出日時 | 2022-08-19 18:25:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 866 ms / 5,000 ms |
コード長 | 2,296 bytes |
コンパイル時間 | 2,525 ms |
コンパイル使用メモリ | 75,672 KB |
実行使用メモリ | 73,192 KB |
最終ジャッジ日時 | 2023-08-24 00:24:47 |
合計ジャッジ時間 | 20,245 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 748 ms
60,712 KB |
testcase_01 | AC | 762 ms
72,336 KB |
testcase_02 | AC | 52 ms
49,308 KB |
testcase_03 | AC | 53 ms
49,576 KB |
testcase_04 | AC | 52 ms
49,444 KB |
testcase_05 | AC | 151 ms
55,444 KB |
testcase_06 | AC | 736 ms
72,216 KB |
testcase_07 | AC | 801 ms
72,872 KB |
testcase_08 | AC | 817 ms
73,192 KB |
testcase_09 | AC | 448 ms
61,560 KB |
testcase_10 | AC | 250 ms
58,780 KB |
testcase_11 | AC | 412 ms
59,000 KB |
testcase_12 | AC | 400 ms
61,128 KB |
testcase_13 | AC | 263 ms
58,976 KB |
testcase_14 | AC | 158 ms
56,172 KB |
testcase_15 | AC | 464 ms
68,576 KB |
testcase_16 | AC | 866 ms
70,784 KB |
testcase_17 | AC | 763 ms
68,692 KB |
testcase_18 | AC | 766 ms
71,000 KB |
testcase_19 | AC | 414 ms
61,152 KB |
testcase_20 | AC | 683 ms
72,560 KB |
testcase_21 | AC | 430 ms
61,032 KB |
testcase_22 | AC | 96 ms
51,652 KB |
testcase_23 | AC | 86 ms
51,896 KB |
testcase_24 | AC | 97 ms
49,916 KB |
testcase_25 | AC | 94 ms
51,696 KB |
testcase_26 | AC | 96 ms
52,264 KB |
testcase_27 | AC | 94 ms
49,592 KB |
testcase_28 | AC | 86 ms
51,928 KB |
testcase_29 | AC | 84 ms
51,640 KB |
testcase_30 | AC | 90 ms
51,676 KB |
testcase_31 | AC | 82 ms
51,640 KB |
testcase_32 | AC | 94 ms
51,600 KB |
testcase_33 | AC | 104 ms
51,568 KB |
testcase_34 | AC | 125 ms
54,044 KB |
testcase_35 | AC | 723 ms
65,640 KB |
testcase_36 | AC | 739 ms
62,252 KB |
testcase_37 | AC | 550 ms
61,100 KB |
testcase_38 | AC | 734 ms
65,500 KB |
testcase_39 | AC | 64 ms
50,484 KB |
testcase_40 | AC | 65 ms
50,188 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); ArrayList<ArrayList<ArrayList<Circle>>> grid = new ArrayList<>(); for (int i = 0; i <= 100; i++) { grid.add(new ArrayList<>()); for (int j = 0; j <= 100; j++) { grid.get(i).add(new ArrayList<>()); } } int count = 0; while (n-- > 0) { Circle x = new Circle(sc.nextInt(), sc.nextInt()); boolean enable = true; for (int i = Math.max(x.r - 1, 0); i <= Math.min(x.r + 1, 100) && enable; i++) { for (int j = Math.max(x.c - 1, 0); j <= Math.min(x.c + 1, 100) && enable; j++) { for (Circle y : grid.get(i).get(j)) { if (x.same(y)) { enable = false; break; } } } } if (enable) { count++; grid.get(x.r).get(x.c).add(x); } } System.out.println(count); } static class Circle { int x; int y; int r; int c; public Circle(int x, int y) { this.x = x; this.y = y; r = x / 200; c = y / 200; } public boolean same(Circle z) { return (x - z.x) * (x - z.x) + (y - z.y) * (y - z.y) < 400; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }