結果

問題 No.1280 Beyond C
ユーザー niboshi_wakainiboshi_wakai
提出日時 2020-11-06 21:49:53
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 1,410 bytes
コンパイル時間 1,627 ms
コンパイル使用メモリ 171,892 KB
実行使用メモリ 5,112 KB
最終ジャッジ日時 2023-09-29 18:37:04
合計ジャッジ時間 3,335 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 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 50 ms
4,380 KB
testcase_16 AC 42 ms
4,376 KB
testcase_17 AC 49 ms
4,376 KB
testcase_18 AC 86 ms
4,808 KB
testcase_19 AC 86 ms
5,112 KB
testcase_20 AC 91 ms
5,112 KB
testcase_21 AC 92 ms
5,100 KB
testcase_22 AC 92 ms
4,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
using ll =long long;
typedef pair<ll,ll> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(ll i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line


const ll dy[] = {0,0,1,-1};
const ll dx[] = {1,-1,0,0};
//const ll mod = 1e9+7;
//const ll mod = 998244353;
const double PI=3.14159265358979323846;
const ll INF = 1001001001;
int main()
{
	ll n, m, c;
	cin >> n >> m >> c;
	vector<ll> a(n);
	rep(i, n)cin>>a[i];
	vector<ll> b(m);
	rep(i, m)cin>>b[i];
	SORT(a);
	SORT(b);
	REV(b); // bは大きい順
	
	ll tmp = 0; // 尺取法のind
	vector<int> cnt(n);
	rep(i,n){
		ll x = a[i];
		// x * b[tmp] >= c なら tmp+1
		if(tmp == m){
			cnt[i] = tmp;
		} else {
			while(x * b[tmp] > c){
				tmp++;
				if(tmp == m) break;
			}
			cnt[i] = tmp;
		}
	}
	ll sum = 0;
	rep(i,n){
		sum += cnt[i];
	}
	debug(sum);
	cout << setprecision(15);
	cout << 1. *((double)sum / (double)(n*m)) << endl;
}
0