結果

問題 No.210 探し物はどこですか?
ユーザー zzblaczzblac
提出日時 2016-02-18 12:17:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 931 bytes
コンパイル時間 989 ms
コンパイル使用メモリ 67,788 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-23 18:04:36
合計ジャッジ時間 4,478 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
4,372 KB
testcase_01 AC 43 ms
4,372 KB
testcase_02 AC 50 ms
4,372 KB
testcase_03 AC 27 ms
4,372 KB
testcase_04 AC 27 ms
4,372 KB
testcase_05 AC 26 ms
4,372 KB
testcase_06 AC 27 ms
4,372 KB
testcase_07 AC 27 ms
4,372 KB
testcase_08 AC 27 ms
4,372 KB
testcase_09 AC 27 ms
4,372 KB
testcase_10 AC 27 ms
4,372 KB
testcase_11 AC 27 ms
4,372 KB
testcase_12 AC 27 ms
4,372 KB
testcase_13 AC 39 ms
4,372 KB
testcase_14 AC 38 ms
4,372 KB
testcase_15 AC 39 ms
4,372 KB
testcase_16 AC 39 ms
4,372 KB
testcase_17 AC 39 ms
4,372 KB
testcase_18 AC 42 ms
4,372 KB
testcase_19 AC 42 ms
4,372 KB
testcase_20 AC 41 ms
4,372 KB
testcase_21 AC 41 ms
4,372 KB
testcase_22 AC 41 ms
4,372 KB
testcase_23 AC 47 ms
4,372 KB
testcase_24 AC 49 ms
4,372 KB
testcase_25 AC 48 ms
4,372 KB
testcase_26 AC 49 ms
4,372 KB
testcase_27 AC 46 ms
4,372 KB
testcase_28 AC 66 ms
4,372 KB
testcase_29 AC 68 ms
4,372 KB
testcase_30 AC 67 ms
4,372 KB
testcase_31 AC 67 ms
4,372 KB
testcase_32 AC 66 ms
4,372 KB
testcase_33 AC 51 ms
4,372 KB
testcase_34 AC 53 ms
4,372 KB
testcase_35 AC 51 ms
4,372 KB
testcase_36 AC 51 ms
4,372 KB
testcase_37 AC 53 ms
4,372 KB
testcase_38 AC 76 ms
4,372 KB
testcase_39 AC 76 ms
4,372 KB
testcase_40 AC 77 ms
4,372 KB
testcase_41 AC 77 ms
4,372 KB
testcase_42 AC 77 ms
4,372 KB
testcase_43 AC 24 ms
4,372 KB
testcase_44 AC 27 ms
4,372 KB
testcase_45 AC 27 ms
4,372 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |                 scanf("%lf", &p[i]);
      |                 ~~~~~^~~~~~~~~~~~~~
main.cpp:32:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   32 |                 scanf("%lf", &q[i]);
      |                 ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
const int maxn = 1e6;
double p[1005], dp[1005],q[1005];
int n;
typedef struct Value{
	double v;
	int x;
	Value(double v = 0, int x = 0) :v(v), x(x){}
	friend bool operator < (Value a, Value b){
		return a.v < b.v;
	}
}Value;
priority_queue<Value> Q;
double v(int x){
	return p[x] * (1 - dp[x]) * q[x];
}
int main(){
	cin >> n;
	for (int i = 0; i < n; i++){
		scanf("%lf", &p[i]);
		p[i] /= 1e3;
	}
	for (int i = 0; i < n; i++){
		scanf("%lf", &q[i]);
		q[i] /= 1e2;
	}
	double g = 0;
	for (int i = 0; i < n; i++) Q.push(Value(v(i), i));
	for (int i = 1; i < maxn; i++){
		if (i%10000 == 0){
			int k = 0;
		}
		int x = Q.top().x;
		Q.pop();
		g += i * v(x);
		dp[x] += (1 - dp[x]) * q[x];
		Q.push(Value(v(x), x));
	}
	printf("%.7lf\n", g);
	return 0;
}
0