結果

問題 No.202 1円玉投げ
ユーザー aaaaaa
提出日時 2015-05-05 12:59:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 264 ms / 5,000 ms
コード長 1,288 bytes
コンパイル時間 1,989 ms
コンパイル使用メモリ 74,936 KB
実行使用メモリ 76,684 KB
最終ジャッジ日時 2023-08-23 22:26:04
合計ジャッジ時間 9,393 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 264 ms
76,080 KB
testcase_01 AC 228 ms
67,916 KB
testcase_02 AC 44 ms
53,324 KB
testcase_03 AC 44 ms
53,444 KB
testcase_04 AC 45 ms
53,364 KB
testcase_05 AC 92 ms
57,140 KB
testcase_06 AC 219 ms
67,968 KB
testcase_07 AC 213 ms
67,892 KB
testcase_08 AC 209 ms
68,108 KB
testcase_09 AC 150 ms
63,552 KB
testcase_10 AC 113 ms
57,600 KB
testcase_11 AC 141 ms
62,576 KB
testcase_12 AC 147 ms
64,104 KB
testcase_13 AC 117 ms
57,468 KB
testcase_14 AC 91 ms
56,408 KB
testcase_15 AC 163 ms
61,704 KB
testcase_16 AC 232 ms
75,640 KB
testcase_17 AC 233 ms
75,476 KB
testcase_18 AC 241 ms
75,824 KB
testcase_19 AC 153 ms
64,140 KB
testcase_20 AC 217 ms
67,544 KB
testcase_21 AC 146 ms
63,116 KB
testcase_22 AC 54 ms
54,076 KB
testcase_23 AC 62 ms
55,224 KB
testcase_24 AC 62 ms
55,080 KB
testcase_25 AC 63 ms
55,324 KB
testcase_26 AC 55 ms
53,664 KB
testcase_27 AC 68 ms
55,824 KB
testcase_28 AC 60 ms
51,876 KB
testcase_29 AC 63 ms
54,896 KB
testcase_30 AC 63 ms
55,680 KB
testcase_31 AC 62 ms
54,760 KB
testcase_32 AC 64 ms
55,476 KB
testcase_33 AC 61 ms
55,220 KB
testcase_34 AC 59 ms
54,320 KB
testcase_35 AC 247 ms
76,192 KB
testcase_36 AC 258 ms
76,684 KB
testcase_37 AC 234 ms
68,156 KB
testcase_38 AC 249 ms
76,164 KB
testcase_39 AC 50 ms
53,464 KB
testcase_40 AC 50 ms
53,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package y202;

import java.io.IOException;
import java.util.ArrayList;

public class Main {
	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while(c != '-' && (c < '0' || c > '9')) c = System.in.read();
			if(c == '-') return -nextInt();
			int res = 0;
			while(c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return -1;
	}
	public static void main(String[] args) {
		int LEN = 1002;
		int N = nextInt();
		ArrayList<int[]> B[][] = new ArrayList[LEN][LEN];
		int ans = 0;
		L:for(int i = 0; i < N; i++) {
			int x = nextInt();
			int y = nextInt();
			int ix = x/20;
			int iy = y/20;
			for(int dx = -1; dx <= 1; dx++)
				for(int dy = -1; dy <= 1; dy++) {
					int tx = ix + dx;
					int ty = iy + dy;
					if(tx < 0 || LEN <= tx || ty < 0 || LEN <= ty || B[tx][ty] == null)
						continue;
					for(int c[]: B[tx][ty]) {
						int ox = c[0];
						int oy = c[1];
						if((ox - x)*(ox - x) + (oy - y)*(oy - y) < 400) {
							continue L;
						}
					}
				}
			
			if(B[ix][iy] == null) {
				B[ix][iy] = new ArrayList<int[]>();
			}
			B[ix][iy].add(new int[]{x, y});
			ans++;
		}
		System.out.println(ans);
	}
}
0