QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#601978#9156. 百万富翁Hunster#15 909ms93896kbC++201.2kb2024-09-30 17:13:592024-09-30 17:13:59

Judging History

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

  • [2024-09-30 17:13:59]
  • 评测
  • 测评结果:15
  • 用时:909ms
  • 内存:93896kb
  • [2024-09-30 17:13:59]
  • 提交

answer

#include <bits/stdc++.h>
#include "richest.h"

constexpr int table[] = {1000000, 500000, 250000, 125000, 62500, 20832, 3472, 183, 1};

constexpr int N = 1000006;

int cnt[N];
std::vector<int> a, b, c;
void query(std::vector<int> vec) {
    for (int i = 0; i < vec.size(); i++)
    for (int j = i + 1; j < vec.size(); j++) {
        a.push_back(vec[i]);
        b.push_back(vec[j]);
    }
}

int richest(int n, int t, int s) {
    std::fill_n(cnt + 1, n, 0);
    std::vector<int> all(n);
    std::iota(all.begin(), all.end(), 0);
    const auto work = [&](int len) {
        int t = all.size() / len, w = all.size() % len;
        a.clear();
        b.clear();
        for (int i = 0, l = 0, r; i < len; i++, l = r) {
            r = l + t + (i < w);
            query(std::vector<int>(all.begin() + l, all.begin() + r));
        }
        c = ask(a, b);
        for (int i = 0; i < a.size(); i++) cnt[a[i] ^ b[i] ^ c[i]]++;
        std::vector<int> _all;
        for (int x : all) if (!cnt[x]) _all.push_back(x);
        std::swap(all, _all);
    };
    if (n == 1000) work(1);
    else for (int i = 1; i <= 8; i++) work(table[i]);
    return all[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 627ms
memory: 26444kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Wrong Answer
time: 898ms
memory: 93896kb

input:

1000000 20 2000000 29091473

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer


Final Tests

Test #1:

score: 15
Accepted
time: 615ms
memory: 26180kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Wrong Answer
time: 909ms
memory: 93700kb

input:

1000000 20 2000000 29091471

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer