QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#762618#5444. Tavern ChessfosovWA 1ms3860kbC++142.1kb2024-11-19 15:50:512024-11-19 15:50:53

Judging History

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

  • [2024-11-19 15:50:53]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3860kb
  • [2024-11-19 15:50:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define ll long long 
#define lll __int128
#define INF 0x3f3f3f3f
#define LNF 0x3f3f3f3f3f3f3f3fll
#define MOD 998244353
#define pii pair<int, int>
#define pdd pair<double, double>
#define tdd tuple<double, double, double>
#define N 20

int n, m;
struct minion {
    int h, a, atk;
    minion() {};
    minion(int h, int a, int atk): h(h), a(a), atk(atk) {};
};

vector<minion> a, b;

tdd dfs(int turn) {
    vector<minion> *x = &a, *y = &b;
    if (turn) swap(x, y);

    int c0 = 0, c1 = 0;
    for (auto& o : *x) c0 += o.h > 0;
    for (auto& o : *y) c1 += o.h > 0;
    if (c0 == 0 && c1 == 0) return { 0, 0, 1 };
    if (c0 == 0) return { 0, 1, 0 };
    if (c1 == 0) return { 1, 0, 0 };

    int mn = INF;
    for (auto& o : *x) {
        if (o.h <= 0) continue;
        mn = min(mn, o.atk);
    }
    double cw = 0, cl = 0, cd = 0;
    for (auto& u : *x) {
        if (u.h <= 0 || u.atk != mn) continue;
        ++ u.atk;
        for (auto& v : *y) {
            if (v.h <= 0) continue;
            u.h -= v.a, v.h -= u.a;
            auto [nw, nl, nd] = dfs(turn ^ 1);
            u.h += v.a, v.h += u.a;
            cw += nl / c1;
            cl += nw / c1;
            cd += nd / c1;
        }
        -- u.atk;
        break;
    }
    return {cw, cl, cd};
}
 
int main() {
#ifdef TEST
    freopen("zz.in", "r+", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << setprecision(18);

    cin >> n >> m;
    for (int i = 0; i < n; ++ i) {
        int h; cin >> h; a.emplace_back(h, h, 0);
    }
    for (int i = 0; i < m; ++ i) {
        int h; cin >> h; b.emplace_back(h, h, 0);
    }

    auto [w0, l0, d0] = dfs(0);
    auto [w1, l1, d1] = dfs(1);

    if (n == m) {
        w0 = (w0 + l1) / 2, l0 = (l0 + w1) / 2, d0 = (d0 + d1) / 2;
        cout << w0 << '\n' << l0 << '\n' << d0 << '\n';
    } else if (n > m) {
        cout << w0 << '\n' << l0 << '\n' << d0 << '\n';
    } else {
        cout << w1 << '\n' << l1 << '\n' << d1 << '\n';
    }
}   

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3860kb

input:

2 3
2 5
3 4 1

output:

0.75
0.125
0.125

result:

wrong answer 1st numbers differ - expected: '0.1250000', found: '0.7500000', error = '0.6250000'