結果

問題 No.202 1円玉投げ
ユーザー GrenacheGrenache
提出日時 2016-06-02 00:17:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,566 ms / 5,000 ms
コード長 2,070 bytes
コンパイル時間 4,481 ms
コンパイル使用メモリ 77,344 KB
実行使用メモリ 78,732 KB
最終ジャッジ日時 2023-08-23 23:22:50
合計ジャッジ時間 27,904 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 574 ms
62,880 KB
testcase_01 AC 1,350 ms
75,956 KB
testcase_02 AC 45 ms
49,952 KB
testcase_03 AC 44 ms
49,896 KB
testcase_04 AC 43 ms
49,896 KB
testcase_05 AC 193 ms
56,516 KB
testcase_06 AC 1,440 ms
78,648 KB
testcase_07 AC 1,466 ms
78,556 KB
testcase_08 AC 1,485 ms
78,672 KB
testcase_09 AC 948 ms
76,224 KB
testcase_10 AC 398 ms
64,536 KB
testcase_11 AC 811 ms
76,104 KB
testcase_12 AC 796 ms
76,660 KB
testcase_13 AC 442 ms
67,824 KB
testcase_14 AC 211 ms
57,116 KB
testcase_15 AC 995 ms
78,732 KB
testcase_16 AC 494 ms
63,424 KB
testcase_17 AC 648 ms
67,500 KB
testcase_18 AC 636 ms
67,556 KB
testcase_19 AC 860 ms
76,164 KB
testcase_20 AC 1,282 ms
76,556 KB
testcase_21 AC 836 ms
76,228 KB
testcase_22 AC 100 ms
52,592 KB
testcase_23 AC 88 ms
53,336 KB
testcase_24 AC 95 ms
52,196 KB
testcase_25 AC 82 ms
52,092 KB
testcase_26 AC 95 ms
52,032 KB
testcase_27 AC 102 ms
51,860 KB
testcase_28 AC 94 ms
52,356 KB
testcase_29 AC 84 ms
52,364 KB
testcase_30 AC 105 ms
53,096 KB
testcase_31 AC 89 ms
52,136 KB
testcase_32 AC 93 ms
52,152 KB
testcase_33 AC 117 ms
52,632 KB
testcase_34 AC 111 ms
52,264 KB
testcase_35 AC 579 ms
65,316 KB
testcase_36 AC 564 ms
63,316 KB
testcase_37 AC 1,566 ms
78,464 KB
testcase_38 AC 582 ms
65,000 KB
testcase_39 AC 71 ms
51,852 KB
testcase_40 AC 54 ms
50,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.Map.*;


public class Main_yukicoder202_1 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Printer pr = new Printer(System.out);

        int n = sc.nextInt();

        SortedMap<Integer, SortedSet<Integer>> xy = new TreeMap<>();

        int ret = 0;
        out:
        for (int i = 0; i < n; i++) {
        	int x = sc.nextInt();
        	int y = sc.nextInt();

        	for (Entry<Integer, SortedSet<Integer>> e : xy.subMap(x - 20, x + 20).entrySet()) {
        		int xtmp = e.getKey();
        		for (int ytmp : e.getValue().subSet(y - 20, y + 20)) {
        			if ((x - xtmp) * (x - xtmp) + (y - ytmp) * (y - ytmp) < 400) {
        				continue out;
        			}
        		}
        	}

			if (xy.containsKey(x)) {
				xy.get(x).add(y);
			} else {
				TreeSet<Integer> tmp = new TreeSet<>();
				tmp.add(y);
				xy.put(x, tmp);
			}
			ret++;
        }

        pr.println(ret);

        pr.close();
        sc.close();
    }

	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
					it = Arrays.asList(br.readLine().split(" ")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}

		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0