結果

問題 No.202 1円玉投げ
ユーザー kou6839
提出日時 2015-05-12 02:08:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 3,394 ms / 5,000 ms
コード長 1,123 bytes
コンパイル時間 2,505 ms
コンパイル使用メモリ 79,472 KB
実行使用メモリ 73,200 KB
最終ジャッジ日時 2024-12-22 09:04:21
合計ジャッジ時間 49,946 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

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<>();
        HashSet<Integer>[] sets = new HashSet[20200];
        int ans=0;
        int x,y;
        for(int k=0;k<n;k++){
            boolean check = true;
             x = Integer.parseInt(sc.next());
             y = Integer.parseInt(sc.next());
            for(int i=Math.max(0, x-19);(i<=Math.min(20000, x+19)&&check);i++){
                int dy = (int) Math.sqrt(399-(i-x)*(i-x)+0.0001);
                for(int j=Math.max(0, y-dy);j<=Math.min(20000, y+dy);j++){
                    if(sets[i]!=null && sets[i].contains(j)) check=false;
                }
            }
            if(check){
                ans++;
                if(sets[x]==null) sets[x]=new HashSet<>();
                sets[x].add(y);
                }
        }
        System.out.println(ans);
    }
}
0