Submission #1943773
Source Code Expand
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(x,y) (x=min(x,y)) #define chmax(x,y) (x=max(x,y)) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} #define N 210 double dp[N][N][N]; ll p[N]; ll n, K; int main(){ cin>>n>>K; rep(i, n){ cin>>p[i]; } //rep(i, N) fill(dp[i], dp[i]+N, -1e10); dp[1][1][0] = 1; for(int i = 1; i < n; i++){ double q = (double)p[i]/100.0; for(int j = 1; j <= n; j++){ for(int k = 0; k <= K; k++){ (j+1+max(0, k-1)<=K?dp[i+1][j+1][max(0, k-1)]:dp[i+1][j][k]) += dp[i][j][k]*q; (j+1+k+1<=K?dp[i+1][j+1][k+1]:dp[i+1][j][k]) += dp[i][j][k]*(1-q); } } } double res = 0; rep(i, n+1) rep(j, K+1){ res += dp[n][i][j]*(K-i); } cout.precision(20); cout<<fixed<<res<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | G - 通勤電車と気分 |
User | Lepton |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1746 Byte |
Status | AC |
Exec Time | 14 ms |
Memory | 33664 KB |
Judge Result
Set Name | Sample | Subtask | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 30 / 30 | 70 / 70 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
Subtask | sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, small_03.txt, small_04.txt, small_05.txt, small_06.txt, subtask_01.txt, subtask_02.txt, subtask_03.txt, subtask_04.txt, subtask_05.txt, subtask_06.txt, subtask_07.txt, subtask_08.txt, subtask_09.txt, subtask_10.txt, subtask_11.txt, subtask_12.txt, subtask_13.txt |
All | large_01.txt, large_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, small_03.txt, small_04.txt, small_05.txt, small_06.txt, subtask_01.txt, subtask_02.txt, subtask_03.txt, subtask_04.txt, subtask_05.txt, subtask_06.txt, subtask_07.txt, subtask_08.txt, subtask_09.txt, subtask_10.txt, subtask_11.txt, subtask_12.txt, subtask_13.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
large_01.txt | AC | 11 ms | 33664 KB |
large_02.txt | AC | 11 ms | 33664 KB |
random_01.txt | AC | 11 ms | 33664 KB |
random_02.txt | AC | 11 ms | 33664 KB |
random_03.txt | AC | 9 ms | 33664 KB |
random_04.txt | AC | 9 ms | 33664 KB |
random_05.txt | AC | 8 ms | 33664 KB |
random_06.txt | AC | 11 ms | 33664 KB |
random_07.txt | AC | 12 ms | 33664 KB |
random_08.txt | AC | 13 ms | 33664 KB |
random_09.txt | AC | 13 ms | 33664 KB |
random_10.txt | AC | 11 ms | 33664 KB |
random_11.txt | AC | 11 ms | 33664 KB |
random_12.txt | AC | 11 ms | 33664 KB |
random_13.txt | AC | 9 ms | 33664 KB |
random_14.txt | AC | 9 ms | 33664 KB |
random_15.txt | AC | 9 ms | 33664 KB |
random_16.txt | AC | 12 ms | 33664 KB |
random_17.txt | AC | 12 ms | 33664 KB |
random_18.txt | AC | 14 ms | 33664 KB |
random_19.txt | AC | 14 ms | 33664 KB |
random_20.txt | AC | 11 ms | 33664 KB |
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 2 ms | 2432 KB |
small_01.txt | AC | 1 ms | 256 KB |
small_02.txt | AC | 1 ms | 256 KB |
small_03.txt | AC | 1 ms | 256 KB |
small_04.txt | AC | 1 ms | 256 KB |
small_05.txt | AC | 1 ms | 256 KB |
small_06.txt | AC | 1 ms | 256 KB |
subtask_01.txt | AC | 2 ms | 2432 KB |
subtask_02.txt | AC | 2 ms | 2432 KB |
subtask_03.txt | AC | 2 ms | 2432 KB |
subtask_04.txt | AC | 2 ms | 2432 KB |
subtask_05.txt | AC | 2 ms | 2432 KB |
subtask_06.txt | AC | 2 ms | 2432 KB |
subtask_07.txt | AC | 2 ms | 2432 KB |
subtask_08.txt | AC | 2 ms | 2432 KB |
subtask_09.txt | AC | 2 ms | 2432 KB |
subtask_10.txt | AC | 2 ms | 2432 KB |
subtask_11.txt | AC | 2 ms | 2432 KB |
subtask_12.txt | AC | 2 ms | 2432 KB |
subtask_13.txt | AC | 2 ms | 2432 KB |