結果

問題 No.210 探し物はどこですか?
ユーザー 沙耶花沙耶花
提出日時 2021-11-04 21:10:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,171 ms / 2,000 ms
コード長 1,152 bytes
コンパイル時間 4,908 ms
コンパイル使用メモリ 261,068 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 04:02:16
合計ジャッジ時間 16,866 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
6,816 KB
testcase_01 AC 217 ms
6,940 KB
testcase_02 AC 256 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 891 ms
6,940 KB
testcase_07 AC 860 ms
6,944 KB
testcase_08 AC 437 ms
6,940 KB
testcase_09 AC 4 ms
6,940 KB
testcase_10 AC 521 ms
6,940 KB
testcase_11 AC 3 ms
6,940 KB
testcase_12 AC 3 ms
6,940 KB
testcase_13 AC 671 ms
6,944 KB
testcase_14 AC 4 ms
6,940 KB
testcase_15 AC 965 ms
6,944 KB
testcase_16 AC 1,004 ms
6,940 KB
testcase_17 AC 1,171 ms
6,940 KB
testcase_18 AC 160 ms
6,944 KB
testcase_19 AC 32 ms
6,940 KB
testcase_20 AC 31 ms
6,944 KB
testcase_21 AC 33 ms
6,940 KB
testcase_22 AC 159 ms
6,944 KB
testcase_23 AC 16 ms
6,944 KB
testcase_24 AC 15 ms
6,940 KB
testcase_25 AC 14 ms
6,940 KB
testcase_26 AC 230 ms
6,944 KB
testcase_27 AC 22 ms
6,940 KB
testcase_28 AC 222 ms
6,940 KB
testcase_29 AC 217 ms
6,940 KB
testcase_30 AC 191 ms
6,940 KB
testcase_31 AC 223 ms
6,940 KB
testcase_32 AC 226 ms
6,944 KB
testcase_33 AC 30 ms
6,940 KB
testcase_34 AC 251 ms
6,940 KB
testcase_35 AC 29 ms
6,940 KB
testcase_36 AC 242 ms
6,940 KB
testcase_37 AC 30 ms
6,944 KB
testcase_38 AC 243 ms
6,940 KB
testcase_39 AC 244 ms
6,940 KB
testcase_40 AC 240 ms
6,940 KB
testcase_41 AC 246 ms
6,940 KB
testcase_42 AC 245 ms
6,940 KB
testcase_43 AC 17 ms
6,940 KB
testcase_44 AC 2 ms
6,940 KB
testcase_45 AC 769 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000000000
using P = pair<double,int>;
P op(P a,P b){
	return max(a,b);
}
P e(){
	return make_pair(0.0,-1);
}

P mapping(double a,P b){
	b.first *= a;
	return b;
}

double composition(double a,double b){
	return a*b;
}

double id(){
	return 1.0;
}

int main(){	
	
	int n;
	cin>>n;
	
	vector<double> p(n),q(n);
	rep(i,n){
		cin>>p[i];
		p[i] /= 1000.0;
	}
	rep(i,n){
		cin>>q[i];
		q[i] /= 100.0;
	}	
	
	double ans = 0.0;
	double pp = 1.0;
	
	vector<P> temp(n);
	rep(i,n)temp[i] = make_pair(p[i]*q[i],i);
	
	lazy_segtree<P,op,e,double,mapping,composition,id> seg(temp);

	rep(_,1000000){
		ans += pp;
		P r = seg.all_prod();
		if(r.second==-1)break;
		pp *= 1.0 - r.first;
		double ps = 1.0;
		r.first /= q[r.second];
		ps -= r.first;
		r.first *= 1.0 - q[r.second];
		ps += r.first;
		r.first *= q[r.second];
		seg.set(r.second,r);
		if(ps<1e-10)break;
		seg.apply(0,n,1.0 / ps);
	}
	
	cout<<fixed<<setprecision(10)<<ans<<endl;

	return 0;
	
}
0