QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#601974#9156. 百万富翁Hunster#0 32ms54400kbC++201.5kb2024-09-30 17:08:192024-09-30 17:08:19

Judging History

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

  • [2024-09-30 17:08:19]
  • 评测
  • 测评结果:0
  • 用时:32ms
  • 内存:54400kb
  • [2024-09-30 17:08:19]
  • 提交

answer

#include <bits/stdc++.h>
#include "richest.h"
// std::vector<int> ask(std::vector<int> a, std::vector<int> b) {
//     std::vector<int> c(a.size());
//     for (int i = 0; i < c.size(); i++) c[i] = std::min(a[i], b[i]);
//     return c;
// }

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(), 1);
    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];
}

// int main() {
//     std::cerr << richest(1000, 0, 0) << std::endl;
//     return 0;
// }

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

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

input:

1000 1 499500 957319859

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds

Pretest #2:

score: 0
Wrong Answer
time: 24ms
memory: 54224kb

input:

1000000 20 2000000 29091473

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds


Final Tests

Test #1:

score: 0
Wrong Answer
time: 4ms
memory: 17248kb

input:

1000 1 499500 957319857

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds

Test #2:

score: 0
Wrong Answer
time: 32ms
memory: 54400kb

input:

1000000 20 2000000 29091471

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds