結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー O2MTO2MT
提出日時 2021-11-07 16:39:21
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 1,014 bytes
コンパイル時間 7,062 ms
コンパイル使用メモリ 147,324 KB
実行使用メモリ 165,392 KB
最終ジャッジ日時 2023-08-08 22:39:17
合計ジャッジ時間 9,810 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
28,912 KB
testcase_01 AC 59 ms
29,060 KB
testcase_02 AC 61 ms
29,304 KB
testcase_03 AC 61 ms
29,352 KB
testcase_04 AC 61 ms
29,164 KB
testcase_05 AC 61 ms
29,152 KB
testcase_06 AC 60 ms
28,992 KB
testcase_07 AC 61 ms
29,380 KB
testcase_08 AC 62 ms
31,244 KB
testcase_09 AC 59 ms
28,912 KB
testcase_10 AC 58 ms
28,848 KB
testcase_11 AC 61 ms
29,204 KB
testcase_12 AC 62 ms
29,288 KB
testcase_13 AC 62 ms
29,412 KB
testcase_14 AC 62 ms
29,196 KB
testcase_15 AC 62 ms
31,224 KB
testcase_16 AC 62 ms
29,548 KB
testcase_17 AC 61 ms
29,196 KB
testcase_18 AC 61 ms
29,428 KB
testcase_19 AC 63 ms
29,476 KB
testcase_20 AC 62 ms
31,268 KB
testcase_21 AC 53 ms
28,532 KB
testcase_22 AC 53 ms
165,392 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 121 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.0/publish/

ソースコード

diff #

using System;
using System.Linq;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var (N, M) = (arr[0], arr[1]);
            var X = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
            var Y = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
            Y.Sort();

            string Binary_search(long key)
            {
                int left = 0, right = (int)Y.Count() - 1;

                while (right >= left)
                {
                    int mid = left + (right - left) / 2;
                    if (Y[mid] > key) right = mid - 1;
                    else left = mid + 1;
                }
                var ans = (right < M - 1) ? (Y[right + 1] - key).ToString() : "Infinity";
                return ans;
            }

            X.ForEach(x => Console.WriteLine(Binary_search(x)));
        }
    }
}
0