結果
| 問題 | No.2923 Mayor's Job | 
| コンテスト | |
| ユーザー |  bluemegane | 
| 提出日時 | 2024-10-13 10:49:21 | 
| 言語 | C# (.NET 8.0.404) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 80 ms / 2,000 ms | 
| コード長 | 1,127 bytes | 
| コンパイル時間 | 11,470 ms | 
| コンパイル使用メモリ | 167,332 KB | 
| 実行使用メモリ | 183,076 KB | 
| 最終ジャッジ日時 | 2024-10-13 10:49:36 | 
| 合計ジャッジ時間 | 13,691 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (105 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = long.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var h = Array.ConvertAll(line, long.Parse);
        getAns(n, k, h);
    }
    static void getAns(int n, long k, long[] h)
    {
        var a = new (long x, long y)[n];
        k *= k;
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var x = long.Parse(line[0]);
            var y = long.Parse(line[1]);
            a[i] = (x, y);
        }
        var c = 0;
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                if (i == j) continue;
                if (h[i] < h[j])
                {
                    var wd = (a[i].x - a[j].x) * (a[i].x - a[j].x) + (a[i].y - a[j].y) * (a[i].y - a[j].y);
                    if (wd <= k) { c++; break; }
                }
            }
        }
        Console.WriteLine(n - c);
    }
}
            
            
            
        