結果

問題 No.1280 Beyond C
ユーザー bonKotsubonKotsu
提出日時 2020-12-10 13:33:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 1,518 ms
コンパイル使用メモリ 170,900 KB
実行使用メモリ 5,320 KB
最終ジャッジ日時 2023-10-20 00:42:32
合計ジャッジ時間 3,822 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 55 ms
4,596 KB
testcase_16 AC 45 ms
4,460 KB
testcase_17 AC 53 ms
4,584 KB
testcase_18 AC 94 ms
5,320 KB
testcase_19 AC 94 ms
5,320 KB
testcase_20 AC 101 ms
5,320 KB
testcase_21 AC 101 ms
5,320 KB
testcase_22 AC 101 ms
5,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>

int main() {
  ll N, M, C;
  cin >> N >> M >> C;

  ll a[N], b[M];
  rep(i, N) cin >> a[i];
  rep(i, M) cin >> b[i];

  sort(a, a+N);
  sort(b, b+M);

  ll p = 0;
  // a[i] に対して a[i] * b[j] > C となる j がいくつあるかを lower_bound を用いて求める.

  rep(i, N) {
    ll t = lower_bound(b, b+M, C/a[i]+1) - b;
    p += M-t;
  }


  double ans = (double)p/(M*N);

  cout << fixed << setprecision(10) << ans << endl;


}
0