QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#502472 | #9156. 百万富翁 | nhuang685 | 15 | 620ms | 80232kb | C++20 | 1.2kb | 2024-08-03 07:00:58 | 2024-08-03 07:01:02 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
int richest(int N, int T, int S) {
std::vector<int> block;
if (N == 1000) {
block = {1000};
} else {
block = {2, 2, 2, 2, 3, 6, 19, 183};
}
std::vector<int> cand(N);
std::iota(cand.begin(), cand.end(), 0);
for (int bl : block) {
// std::cerr << cand.size() << '\n';
std::vector<int> ncand;
std::vector<int> a, b;
std::vector<int> nc(N);
for (int i = 0; i < std::ssize(cand); i += bl) {
int r;
if (bl <= 6 && std::ssize(cand) - i < 2 * bl) {
r = static_cast<int>(cand.size()) - 1;
} else if (bl == 19 && i <= 72) {
r = i + bl - 2;
} else {
r = i + bl - 1;
}
for (int j = i; j <= r; ++j) {
nc[cand[j]] = r - i;
for (int k = j + 1; k <= r; ++k) {
a.push_back(cand[j]);
b.push_back(cand[k]);
}
}
if (bl == 19 && i <= 72) {
i -= 1;
}
}
std::vector<int> t = ask(a, b);
std::vector<int> freq(N);
for (int i : t) {
++freq[i];
}
for (int i : cand) {
if (freq[i] == nc[i]) {
ncand.push_back(i);
}
}
cand = ncand;
}
return cand[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 620ms
memory: 25324kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Wrong Answer
time: 411ms
memory: 80108kb
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: 597ms
memory: 25404kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Wrong Answer
time: 195ms
memory: 80232kb
input:
1000000 20 2000000 29091471
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer