結果
| 問題 |
No.662 スロットマシーン
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2018-03-09 23:02:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,514 bytes |
| コンパイル時間 | 1,136 ms |
| コンパイル使用メモリ | 117,064 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-10 11:16:20 |
| 合計ジャッジ時間 | 2,182 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 10 |
ソースコード
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>
#include <string>
#include <cstring>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>
#include <ctime>
////
#include <random>//
#pragma endregion //#include
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;
void solve(){
vector<string> ega(5);
vector<LL> out(5);
for(int i=0;i<5;++i){
cin>> ega[i] >> out[i];
}
vector<int> num(3);
vector< vector<int> > ree(3,vector<int>(125,0));
for(int i=0;i<3;++i){
cin >> num[i];
vector<int> A(num[i]);
string str;
for(int j=0;j<num[i];++j){
cin >> str;
for(int k=0;k<5;++k){
if( str == ega[k] ){
A[j] = k;
break;
}
}
}
for(int j=0;j<num[i];++j){
int a = j;
int b = (j+1)%num[i];
int c = (j+2)%num[i];
int val = A[a] + 5*A[b] + 25*A[c];
ree[i][val]++;
}
}
///////////
vector<vector<int> > game(3,vector<int>(3));
vector<int> atari(5,0);
LL ALL = 0;
LD ALL_P = num[0]*num[1]*num[2];
LD ansP = 0;
for(int a=0;a<125;++a){
if( ree[0][a] == 0 ) continue;
for(int b=0;b<125;++b){
if( ree[1][b] == 0 ) continue;
for(int c=0;c<125;++c){
if( ree[2][c] == 0 ) continue;
int ter = a;game[0][0] = ter%5;
ter /= 5;game[1][0] = ter%5;
ter /=5;game[2][0] = ter;
ter = b;game[0][1] = ter%5;
ter /= 5;game[1][1] = ter%5;
ter /=5;game[2][1] = ter;
ter = c;game[0][2] = ter%5;
ter /= 5;game[1][2] = ter%5;
ter /=5;game[2][2] = ter;
if( game[0][0]==game[0][1] && game[0][1]==game[0][2] ){
int kind = game[0][0];
LL kaisuu = ree[0][a]*ree[1][b]*ree[2][c];
atari[kind] += kaisuu;
ALL += kaisuu*out[kind];
ansP += (LD)1.0*kaisuu*out[kind]/ALL_P;
}
if( game[1][0]==game[1][1] && game[1][1]==game[1][2] ){
int kind = game[1][0];
LL kaisuu = ree[0][a]*ree[1][b]*ree[2][c];
atari[kind] += kaisuu;
ALL += kaisuu*out[kind];
ansP += (LD)1.0*kaisuu*out[kind]/ALL_P;
}
if( game[2][0]==game[2][1] && game[2][1]==game[2][2] ){
int kind = game[2][0];
LL kaisuu = ree[0][a]*ree[1][b]*ree[2][c];
atari[kind] += kaisuu;
ALL += kaisuu*out[kind];
ansP += (LD)1.0*kaisuu*out[kind]/ALL_P;
}
if( game[0][0]==game[1][1] && game[1][1]==game[2][2] ){
int kind = game[0][0];
LL kaisuu = ree[0][a]*ree[1][b]*ree[2][c];
atari[kind] += kaisuu;
ALL += kaisuu*out[kind];
ansP += (LD)1.0*kaisuu*out[kind]/ALL_P;
}
if( game[2][0]==game[1][1] && game[1][1]==game[0][2] ){
int kind = game[1][1];
LL kaisuu = ree[0][a]*ree[1][b]*ree[2][c];
atari[kind] += kaisuu;
ALL += kaisuu*out[kind];
ansP += (LD)1.0*kaisuu*out[kind]/ALL_P;
}
}
}
}
cout << ansP << endl;
for(int i=0;i<5;++i){
cout << atari[i] << endl;
}
}
#pragma region main
signed main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//小数を10進数表示
cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別
solve();
}
#pragma endregion //main()
IL_msta