結果

問題 No.1280 Beyond C
ユーザー どららどらら
提出日時 2020-11-06 21:38:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 1,156 bytes
コンパイル時間 1,739 ms
コンパイル使用メモリ 181,968 KB
実行使用メモリ 14,892 KB
最終ジャッジ日時 2023-09-29 18:25:46
合計ジャッジ時間 4,024 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,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 76 ms
9,996 KB
testcase_16 AC 72 ms
11,800 KB
testcase_17 AC 85 ms
12,152 KB
testcase_18 AC 83 ms
4,380 KB
testcase_19 AC 82 ms
4,380 KB
testcase_20 AC 140 ms
14,892 KB
testcase_21 AC 142 ms
14,736 KB
testcase_22 AC 142 ms
14,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll N, M, C;
  cin >> N >> M >> C;
  vector<ll> v;
  rep(i,N){
    ll a;
    cin >> a;
    v.push_back(a);
  }
  map<ll,ll> cnt;
  rep(i,M){
    ll a;
    cin >> a;
    cnt[a]++;
  }

  vector<pair<ll,ll>> w;
  FOR(it,cnt){
    w.emplace_back(it->first, it->second);
  }
  reverse(ALLOF(w));

  vector<pair<ll,ll>> csum;
  ll base = 0;
  rep(i,w.size()){
    base += w[i].second;
    csum.emplace_back(w[i].first, base);
  }
  sort(ALLOF(csum));
  
  double ret = 0;
  rep(i,N){
    if(csum[0].first * v[i] > C){
      ret += (1.0 / N);
    }else{
      int lb = 0, ub = w.size();
      while(ub-lb>1){
        int m = (lb+ub)/2;
        if(csum[m].first * v[i] <= C) lb = m;
        else ub = m;
      }
      if(ub<w.size()){
        ret += (1.0 / N) * csum[ub].second / M;
      }
    }
  }
  
  printf("%.12lf\n", ret);
  
  return 0;
}
0