結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー 👑 kakel-sankakel-san
提出日時 2021-10-29 21:53:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 1,130 bytes
コンパイル時間 4,901 ms
コンパイル使用メモリ 108,540 KB
実行使用メモリ 24,140 KB
最終ジャッジ日時 2023-07-29 07:45:02
合計ジャッジ時間 6,840 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
21,916 KB
testcase_01 AC 61 ms
24,140 KB
testcase_02 AC 62 ms
21,920 KB
testcase_03 AC 62 ms
21,976 KB
testcase_04 AC 61 ms
22,004 KB
testcase_05 AC 60 ms
22,120 KB
testcase_06 AC 61 ms
21,956 KB
testcase_07 AC 63 ms
22,040 KB
testcase_08 AC 62 ms
22,044 KB
testcase_09 AC 62 ms
22,076 KB
testcase_10 AC 57 ms
23,860 KB
testcase_11 AC 61 ms
22,084 KB
testcase_12 AC 62 ms
24,020 KB
testcase_13 AC 62 ms
24,052 KB
testcase_14 AC 62 ms
21,940 KB
testcase_15 AC 65 ms
22,060 KB
testcase_16 AC 65 ms
21,956 KB
testcase_17 AC 62 ms
21,980 KB
testcase_18 AC 62 ms
22,040 KB
testcase_19 AC 63 ms
24,000 KB
testcase_20 AC 61 ms
24,112 KB
testcase_21 AC 52 ms
23,904 KB
testcase_22 AC 53 ms
22,048 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using static System.Console;
using System.Linq;

class yuki320
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray();
    static void Main()
    {
        var c = NList;
        var x = NList;
        var y = NList;
        Array.Sort(y);
        var res = new string[x.Length];
        for (var i = 0; i < x.Length; ++i)
        {
            var pos = Pos(x[i], y);
            if (pos == y.Length) res[i] = "Infinity";
            else res[i] = (y[pos] - x[i]).ToString();
        }
        WriteLine(string.Join("\n", res));
    }
    static int Pos(int val, int[] list)
    {
        if (val > list[list.Length - 1]) return list.Length;
        var ng = -1;
        var ok = list.Length - 1;
        while (ok - ng > 1)
        {
            var center = (ok + ng) / 2;
            if (val <= list[center]) ok = center;
            else ng = center;
        }
        return ok;
    }
}
0