結果

問題 No.662 スロットマシーン
ユーザー KKT89KKT89
提出日時 2021-03-04 00:21:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 923 bytes
コンパイル時間 2,517 ms
コンパイル使用メモリ 204,364 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 16:19:09
合計ジャッジ時間 3,397 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 4 ms
6,940 KB
testcase_10 AC 4 ms
6,944 KB
testcase_11 AC 4 ms
6,940 KB
testcase_12 AC 4 ms
6,944 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 4 ms
6,944 KB
testcase_15 AC 5 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 5 ms
6,944 KB
testcase_18 AC 4 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n=5;
	vector<string> v(n);
	vector<ll> cost(n);
	for(int i=0;i<n;i++){
		cin >> v[i] >> cost[i];
	}
	vector<ll> res(n);
	vector<vector<string>> sr(3);
	for(int i=0;i<3;i++){
		int m; cin >> m;
		while(m--){
			string s; cin >> s;
			sr[i].push_back(s);
		}
	}
	for(int i=0;i<n;i++){
		ll r=5;
		for(int j=0;j<3;j++){
			ll cnt=0;
			for(string s:sr[j]){
				if(s==v[i])cnt++;
			}
			r*=cnt;
		}
		res[i]=r;
	}
	ll m=1;
	for(int i=0;i<3;i++){
		m*=(ll)(sr[i].size());
	}
	printf("%.9f\n",(res[0]*cost[0]+res[1]*cost[1]+res[2]*cost[2]+res[3]*cost[3]+res[4]*cost[4])/(double)(m));
	for(int i=0;i<n;i++){
		printf("%lld\n",res[i]);
	}
}
0