QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#601977 | #9156. 百万富翁 | Hunster# | 0 | 32ms | 54416kb | C++20 | 1.2kb | 2024-09-30 17:12:37 | 2024-09-30 17:12:37 |
Judging History
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(), 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];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 5ms
memory: 17176kb
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: 26ms
memory: 54272kb
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: 17160kb
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: 54416kb
input:
1000000 20 2000000 29091471
output:
Index out of bounds 9775460264716263939 0.000000 6906350380861515327
result:
points 0.0 Index out of bounds