QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#617402 | #5435. Clamped Sequence | Cipherxzc# | WA | 0ms | 3840kb | C++23 | 1.1kb | 2024-10-06 15:22:59 | 2024-10-06 15:22:59 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
const int N=50;
const ld eps=1e-12;
struct node{
int x,id;
}c[N];
int a[2][N];
int l[2],r[2];
int n,m;
ld an;
inline int ck(int x){
for(int i=1;i<=l[x];++i)
if (a[x][i]) return 0;
return 1;
}
void dfs(int x,ld p){
if (p<=eps) return;
if (!r[x]){
if (x) an+=p;
return;
}
int t=1;
while(!a[x][t]) t++;
for(int i=1;i<=l[x^1];++i){
if (!a[x^1][i]) continue;
int res=a[x^1][i];
a[x^1][i]=max(0,a[x^1][i]-a[x][t]);
ld q=1.L/r[x^1];
if (!a[x^1][i]) r[x^1]--;
dfs(x^1,p*q);
if (!a[x^1][i]) r[x^1]++;
a[x^1][i]=res;
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
std::cout << std::fixed << std::setprecision(15);
cin >> n >> m;
l[0]=r[0]=n;
l[1]=r[0]=m;
for(int i=1;i<=n;++i)
cin >> a[0][i];
for(int i=1;i<=m;++i)
cin >> a[1][i];
dfs(0,1);
dfs(1,1);
an=an/2;
cout << an;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
8 3 3 1 4 1 5 9 2 6
output:
0.500000000000000
result:
wrong output format Expected integer, but "0.500000000000000" found