QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#617402#5435. Clamped SequenceCipherxzc#WA 0ms3840kbC++231.1kb2024-10-06 15:22:592024-10-06 15:22:59

Judging History

你现在查看的是最新测评结果

  • [2024-10-06 15:22:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2024-10-06 15:22:59]
  • 提交

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;
}

详细

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