結果

問題 No.1265 Balloon Survival
ユーザー keymoonkeymoon
提出日時 2020-10-23 23:30:54
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,813 bytes
コンパイル時間 3,687 ms
コンパイル使用メモリ 106,920 KB
実行使用メモリ 23,996 KB
最終ジャッジ日時 2023-09-28 18:47:00
合計ジャッジ時間 12,737 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
21,976 KB
testcase_01 AC 66 ms
23,948 KB
testcase_02 AC 66 ms
22,112 KB
testcase_03 AC 66 ms
21,992 KB
testcase_04 AC 66 ms
21,848 KB
testcase_05 AC 65 ms
19,752 KB
testcase_06 AC 66 ms
22,032 KB
testcase_07 AC 67 ms
23,980 KB
testcase_08 AC 69 ms
22,036 KB
testcase_09 AC 67 ms
21,864 KB
testcase_10 AC 66 ms
23,996 KB
testcase_11 AC 66 ms
23,904 KB
testcase_12 AC 66 ms
21,956 KB
testcase_13 AC 66 ms
21,944 KB
testcase_14 AC 1,501 ms
21,920 KB
testcase_15 AC 984 ms
21,944 KB
testcase_16 AC 284 ms
22,104 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        long[][] pts = Enumerable.Repeat(0, n).Select(_ => Console.ReadLine().Split().Select(long.Parse).ToArray()).ToArray();
        List<int> remain = Enumerable.Range(0, n).ToList();
        int res = 0;
        int curSquareT = 0;
        while (remain.Count > 1)
        {
            long valid = curSquareT;
            long invalid = long.MaxValue;
            while (invalid - valid > 1)
            {
                var mid = (invalid + valid) / 2;
                for (int i = 0; i < remain.Count; i++)
                    for (int j = i + 1; j < remain.Count; j++)
                        if (GetDist(pts[remain[i]], pts[remain[j]]) <= mid) goto inv;
                valid = mid;
                continue;
                inv:;
                invalid = mid;
            }

            for (int i = 0; i < remain.Count; i++)
                for (int j = i + 1; j < remain.Count; j++)
                    if (GetDist(pts[remain[i]], pts[remain[j]]) == invalid)
                    {
                        remain.RemoveAt(j);
                        if (i != 0) remain.RemoveAt(i);
                        else res++;
                        goto end;
                    }
            end:;
        }
        Console.WriteLine(res);
    }

    static long GetDist(long[] a, long[] b)
    {
        var dy = a[0] - b[0];
        var dx = a[1] - b[1];
        return dy * dy + dx * dx;
    }
}
0