結果

問題 No.202 1円玉投げ
ユーザー aaaaaa
提出日時 2015-05-05 12:55:03
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,288 bytes
コンパイル時間 3,286 ms
コンパイル使用メモリ 74,440 KB
実行使用メモリ 57,388 KB
最終ジャッジ日時 2023-08-23 22:25:13
合計ジャッジ時間 7,610 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 49 ms
53,476 KB
testcase_03 AC 48 ms
53,412 KB
testcase_04 AC 49 ms
51,664 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 67 ms
54,800 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
権限があれば一括ダウンロードができます

ソースコード

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[ty][tx]) {
						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