QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#411236#6749. TargetKunoSayoWA 0ms3632kbC++232.5kb2024-05-15 10:23:472024-05-15 10:23:48

Judging History

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

  • [2024-05-15 10:23:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3632kb
  • [2024-05-15 10:23:47]
  • 提交

answer

#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedTypeAliasInspection"
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"

typedef unsigned long long ull;
typedef long long ll;

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>

using namespace std;

template<typename T, typename U>
T check_read(T left, U right) {
    T val;
    if (cin >> val) {
        if (val < left || val > right) {
            throw "??";
        }
        return val;
    }
    throw "?";
}

const int MAXN = 1e5 + 9;

ull mod = 998244353;

ull fpow(ull x, ull n) {
    ull ret = 1;
    while (n) {
        if (n & 1) ret = ret * x % mod;
        n >>= 1;
        x = x * x % mod;
    }
    return ret;
}

int b[10];

map<vector<char>, ull> dp;
int n;
ull divcache[12];

ull dfs(vector<char> &cur) {

    // E(..) = 1 + (1/n) E(..-1, ..)  +
    //        + (nz / n) E(..)
    // (n-nz/n) E(..) = 1 + ..
    //  E(..) = n / (n - nz) (before)
    auto it = dp.find(cur);
    if (it != dp.end()) {
        return it->second;
    }
    ull ret = 1;

    ull nz = 0;
    for (int i = 0; i < n; ++i) {
        if (cur[i] > 0) {
            --cur[i];
            ull result = dfs(cur);

            ret += result * divcache[n];
            ret %= mod;

            ++cur[i];
        } else if (cur[i] == 0) {
            ++nz;
        }
    }
    if (nz) {
        ret *= n;
        ret %= mod;
        ret *= divcache[n - nz];
        ret %= mod;
    }
    dp[cur] = ret;
    return ret;
}

void solve() {
    double u;
    double d = 0.975;
    cin >> u >> d;

    ull data = *(ull *) &d;

    int exp = 0;
    for (int i = 62; i >= 52; --i) {
        exp = (exp << 1) | ((data >> i) & 1);
    }

    exp -= 1023;

    int after_ans = 1 - exp;
    int ops = 0;
    // 2 - 51
    // 1 - 50
    // 0 - 49
    for (int i = 0, j = after_ans + 3; i < 49 - after_ans; ++i, ++j) {
        cout << (1 + ((data >> j) & 1));
        if (++ops >= 49) throw "impossible.";
    }
    cout << 2;
    for (int i = exp; i < 0; ++i) {
        cout << 1;
        if (++ops >= 49) throw "?";
    }


}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed;
    cout.precision(18);


    int T = 1;
    while (T--) {
        solve();
    }


    return 0;
}


#pragma clang diagnostic pop

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3632kb

input:

0.5 0.25

output:

1111111111111111111111111111111111111111111111211

result:

wrong answer wa