結果
問題 | No.162 8020運動 |
ユーザー | beet |
提出日時 | 2019-04-01 20:30:23 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,647 ms / 5,000 ms |
コード長 | 1,497 bytes |
コンパイル時間 | 3,407 ms |
コンパイル使用メモリ | 238,156 KB |
実行使用メモリ | 231,552 KB |
最終ジャッジ日時 | 2024-05-04 18:44:55 |
合計ジャッジ時間 | 43,372 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 845 ms
231,424 KB |
testcase_01 | AC | 1,209 ms
231,296 KB |
testcase_02 | AC | 1,419 ms
231,424 KB |
testcase_03 | AC | 1,616 ms
231,424 KB |
testcase_04 | AC | 1,612 ms
231,424 KB |
testcase_05 | AC | 1,608 ms
231,424 KB |
testcase_06 | AC | 1,622 ms
231,424 KB |
testcase_07 | AC | 1,634 ms
231,424 KB |
testcase_08 | AC | 1,647 ms
231,424 KB |
testcase_09 | AC | 825 ms
231,552 KB |
testcase_10 | AC | 1,425 ms
231,424 KB |
testcase_11 | AC | 1,231 ms
231,424 KB |
testcase_12 | AC | 991 ms
231,424 KB |
testcase_13 | AC | 1,613 ms
231,424 KB |
testcase_14 | AC | 876 ms
231,424 KB |
testcase_15 | AC | 888 ms
231,424 KB |
testcase_16 | AC | 1,038 ms
231,424 KB |
testcase_17 | AC | 909 ms
231,424 KB |
testcase_18 | AC | 1,564 ms
231,424 KB |
testcase_19 | AC | 1,375 ms
231,424 KB |
testcase_20 | AC | 1,443 ms
231,424 KB |
testcase_21 | AC | 1,448 ms
231,424 KB |
testcase_22 | AC | 1,398 ms
231,296 KB |
testcase_23 | AC | 1,458 ms
231,424 KB |
testcase_24 | AC | 1,403 ms
231,424 KB |
testcase_25 | AC | 1,479 ms
231,424 KB |
testcase_26 | AC | 826 ms
231,424 KB |
testcase_27 | AC | 1,242 ms
231,552 KB |
testcase_28 | AC | 1,553 ms
231,424 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} struct Precision{ Precision(){ cout<<fixed<<setprecision(12); } }precision_beet; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<typename T,typename U> using gmap = cc_hash_table<T, U, hash<T> >; //INSERT ABOVE HERE signed main(){ using D = double; using M = gmap<int, D>; int a; cin>>a; a=80-a; D p[3]; for(int i=0;i<3;i++) cin>>p[i],p[i]/=100; const int t=14; int s=1<<t; vector<M> co(s); vector<vector<int> > vs(s,vector<int>(t+2)); for(int b=0;b<s;b++) for(int i=0;i<t;i++) vs[b][i+1]=(b>>i)&1; for(int b=0;b<s;b++){ vector<D> po(t); for(int i=0;i<t;i++){ if((~b>>i)&1) continue; po[i]=p[vs[b][i]+vs[b][i+2]]; } for(int nb=b;nb;nb=(nb-1)&b){ D &res=co[b][nb]; res=1.0; for(int i=0;i<t;i++){ if((~b>>i)&1) continue; if((~nb>>i)&1) res*=po[i]; else res*=1.0-po[i]; } } } vector<D> dp(s,0); dp[s-1]=1.0; for(int i=0;i<a;i++){ vector<D> nx(s,0); for(int b=0;b<s;b++) for(int nb=b;nb;nb=(nb-1)&b) nx[nb]+=dp[b]*co[b][nb]; swap(dp,nx); } D ans=0; for(int b=0;b<s;b++) ans+=__builtin_popcount(b)*dp[b]; cout<<ans*2<<endl; return 0; }