結果

問題 No.1280 Beyond C
ユーザー bluemeganebluemegane
提出日時 2020-11-08 07:46:42
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,507 bytes
コンパイル時間 978 ms
コンパイル使用メモリ 63,772 KB
実行使用メモリ 24,748 KB
最終ジャッジ日時 2023-09-29 21:05:41
合計ジャッジ時間 3,962 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
22,772 KB
testcase_01 AC 63 ms
22,672 KB
testcase_02 AC 64 ms
20,540 KB
testcase_03 AC 63 ms
22,868 KB
testcase_04 AC 62 ms
18,668 KB
testcase_05 AC 64 ms
22,552 KB
testcase_06 AC 65 ms
24,604 KB
testcase_07 AC 65 ms
24,748 KB
testcase_08 AC 64 ms
22,724 KB
testcase_09 AC 65 ms
24,668 KB
testcase_10 AC 65 ms
22,760 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
権限があれば一括ダウンロードができます

ソースコード

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 = int.Parse(line[2]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        line = (Console.ReadLine().Trim() + " 0").Split(' ');
        var b = Array.ConvertAll(line, int.Parse);
        Array.Sort(b);
        getAns(n, m, c, a, b);
    }
    static void getAns(int n, int m, int c, int[] a, int[] 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