QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#502478 | #9156. 百万富翁 | nhuang685 | 100 ✓ | 2281ms | 86392kb | C++20 | 1.2kb | 2024-08-03 07:10:32 | 2024-08-03 07:10:32 |
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);
int r;
for (int i = 0; i < std::ssize(cand); i = r + 1) {
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 - 1) - 1;
} 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: 603ms
memory: 25436kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 2241ms
memory: 86344kb
input:
1000000 20 2000000 29091473
output:
Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944 7610580723948932399 1.000000 1331569654267968081
result:
points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
Final Tests
Test #1:
score: 15
Accepted
time: 601ms
memory: 25384kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 2281ms
memory: 86392kb
input:
1000000 20 2000000 29091471
output:
Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944 7610580723948932399 1.000000 1331569654267968081
result:
points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944