結果

問題 No.202 1円玉投げ
ユーザー kou6839
提出日時 2015-05-12 01:57:31
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 872 bytes
コンパイル時間 2,256 ms
コンパイル使用メモリ 77,956 KB
実行使用メモリ 138,796 KB
最終ジャッジ日時 2024-12-22 09:01:26
合計ジャッジ時間 98,329 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 18 TLE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.File;
import java.util.*;

public class Main {
	public static void main(String[] args){
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashSet<Integer> xSet = new HashSet<>();
		HashSet<Integer> ySet = new HashSet<>();
		int []x = new int[n];
		int []y = new int[n];
		int ans=0;
		for(int i=0;i<n;i++){
			boolean check = true;
			 x[i] = Integer.parseInt(sc.next());
			 y[i] = Integer.parseInt(sc.next());
			for(int xx=Math.max(0, x[i]-19);xx<=Math.min(20000, x[i]+19)&&check;xx++){
				int dy = (int) Math.sqrt(399-(i-xx)*(i-xx));
				for(int yy=Math.max(0, y[i]-dy);yy<=Math.min(20000, y[i]+dy);yy++){
					if(xSet.contains(xx)&&ySet.contains(yy)) check=false;
				}
			}
			if(check){
				ans++;
				xSet.add(x[i]);
				ySet.add(y[i]);
			}
		}
		System.out.println(ans);
	}
}
0