結果

問題 No.210 探し物はどこですか?
ユーザー 沙耶花沙耶花
提出日時 2021-11-04 21:08:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,156 bytes
コンパイル時間 4,791 ms
コンパイル使用メモリ 256,820 KB
最終ジャッジ日時 2025-01-25 11:43:42
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 1 RE * 17
権限があれば一括ダウンロードができます

ソースコード

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(_,450000){
		ans += pp;
		P r = seg.all_prod();
	//	if(_<10)cout<<r.first<<','<<r.second<<endl;
		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);
		
		seg.apply(0,n,1.0 / ps);
	}
	
	cout<<fixed<<setprecision(10)<<ans<<endl;

	return 0;
	
}
0