結果
| 問題 | No.1280 Beyond C | 
| コンテスト | |
| ユーザー |  bluemegane | 
| 提出日時 | 2020-11-08 09:05:28 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 171 ms / 2,000 ms | 
| コード長 | 1,513 bytes | 
| コンパイル時間 | 885 ms | 
| コンパイル使用メモリ | 105,984 KB | 
| 実行使用メモリ | 44,672 KB | 
| 最終ジャッジ日時 | 2024-07-22 15:01:19 | 
| 合計ジャッジ時間 | 3,718 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);
    }
}
            
            
            
        