結果

問題 No.1280 Beyond C
ユーザー bluemeganebluemegane
提出日時 2020-11-08 09:05:28
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 1,513 bytes
コンパイル時間 808 ms
コンパイル使用メモリ 65,780 KB
実行使用メモリ 50,548 KB
最終ジャッジ日時 2023-09-29 21:05:52
合計ジャッジ時間 4,339 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
22,732 KB
testcase_01 AC 62 ms
22,812 KB
testcase_02 AC 60 ms
20,784 KB
testcase_03 AC 58 ms
22,848 KB
testcase_04 AC 58 ms
20,768 KB
testcase_05 AC 62 ms
22,852 KB
testcase_06 AC 59 ms
24,836 KB
testcase_07 AC 61 ms
22,700 KB
testcase_08 AC 58 ms
22,952 KB
testcase_09 AC 58 ms
22,688 KB
testcase_10 AC 60 ms
22,856 KB
testcase_11 AC 70 ms
22,776 KB
testcase_12 AC 65 ms
21,088 KB
testcase_13 AC 69 ms
22,872 KB
testcase_14 AC 66 ms
22,876 KB
testcase_15 AC 135 ms
38,288 KB
testcase_16 AC 114 ms
33,720 KB
testcase_17 AC 131 ms
39,024 KB
testcase_18 AC 169 ms
42,792 KB
testcase_19 AC 174 ms
45,052 KB
testcase_20 AC 190 ms
50,548 KB
testcase_21 AC 184 ms
48,444 KB
testcase_22 AC 193 ms
50,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Collections.Generic;
using System;

public class hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var c = long.Parse(line[2]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        line = (Console.ReadLine().Trim() + " 0").Split(' ');
        var b = Array.ConvertAll(line, long.Parse);
        Array.Sort(b);
        getAns(n, m, c, a, b);
    }
    static void getAns(int n, int m, long c, long[] a, long[] b)
    {
        var count = 0L;
        for (int i = 0; i < n; i++)
        {
            var t = c / a[i];
            if (t * a[i] <= c) t++;
            var p = LowerBound(b, t);
            if (p != m + 1) count += m - p + 1;
        }
        var ans = (double)count / n / m;
        Console.WriteLine(ans);
    }
    public static int LowerBound<T>(T[] arr, int start, int end, T value, IComparer<T> comparer)
    {
        int low = start;
        int high = end;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (comparer.Compare(arr[mid], value) < 0)
                low = mid + 1;
            else
                high = mid;
        }
        return low;
    }
    public static int LowerBound<T>(T[] arr, T value) where T : IComparable
    {
        return LowerBound(arr, 0, arr.Length, value, Comparer<T>.Default);
    }
}
0