結果

問題 No.1280 Beyond C
ユーザー umezoumezo
提出日時 2020-11-06 22:24:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 682 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 204,896 KB
実行使用メモリ 4,832 KB
最終ジャッジ日時 2023-09-29 19:04:03
合計ジャッジ時間 3,872 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 51 ms
4,376 KB
testcase_16 AC 41 ms
4,380 KB
testcase_17 AC 50 ms
4,376 KB
testcase_18 AC 86 ms
4,632 KB
testcase_19 AC 87 ms
4,576 KB
testcase_20 AC 96 ms
4,624 KB
testcase_21 AC 95 ms
4,832 KB
testcase_22 AC 96 ms
4,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include <bits/stdc++.h>
using namespace std;

const ll INF=1e9+7;

ll c;
bool f(ll a,ll x){
  if(x==INF) return true;
  else if(a*x>c) return true;
  else return false;
}

int main(){
  ll n,m;
  cin>>n>>m>>c;
  
  vector<ll> A(n+1),B(m+2);
  rep(i,n) cin>>A[i+1];
  rep(i,m) cin>>B[i+1];
  B[m+1]=INF;
  sort(ALL(B));
  
  ll cnt=0;
  for(int i=1;i<=n;i++){
    int ng=0,ok=m+1;
    while(ok-ng>1){
      int mid=ng+(ok-ng)/2;
      if(f(A[i],B[mid])) ok=mid;
      else ng=mid;
    }
    cnt+=m-ng;
  }
  cout<<fixed<<setprecision(10)<<(double)cnt/(n*m)<<endl;
  
  return 0;
}
0