結果

問題 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  
実行時間 36 ms / 2,000 ms
コード長 1,130 bytes
コンパイル時間 3,031 ms
コンパイル使用メモリ 107,648 KB
実行使用メモリ 19,968 KB
最終ジャッジ日時 2024-04-16 14:43:28
合計ジャッジ時間 4,745 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
19,328 KB
testcase_01 AC 34 ms
19,584 KB
testcase_02 AC 35 ms
19,712 KB
testcase_03 AC 35 ms
19,584 KB
testcase_04 AC 35 ms
19,968 KB
testcase_05 AC 34 ms
19,840 KB
testcase_06 AC 35 ms
19,840 KB
testcase_07 AC 34 ms
19,584 KB
testcase_08 AC 35 ms
19,840 KB
testcase_09 AC 35 ms
19,584 KB
testcase_10 AC 31 ms
19,072 KB
testcase_11 AC 36 ms
19,712 KB
testcase_12 AC 36 ms
19,840 KB
testcase_13 AC 36 ms
19,712 KB
testcase_14 AC 36 ms
19,712 KB
testcase_15 AC 34 ms
19,968 KB
testcase_16 AC 36 ms
19,840 KB
testcase_17 AC 35 ms
19,712 KB
testcase_18 AC 36 ms
19,840 KB
testcase_19 AC 35 ms
19,712 KB
testcase_20 AC 35 ms
19,712 KB
testcase_21 AC 27 ms
19,072 KB
testcase_22 AC 28 ms
18,816 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