結果
| 問題 |
No.1280 Beyond C
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2020-11-08 07:46:42 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,507 bytes |
| コンパイル時間 | 1,666 ms |
| コンパイル使用メモリ | 110,880 KB |
| 実行使用メモリ | 25,568 KB |
| 最終ジャッジ日時 | 2024-07-22 15:01:08 |
| 合計ジャッジ時間 | 2,275 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 RE * 12 |
コンパイルメッセージ
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 = 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);
}
}
bluemegane