QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#508232 | #9156. 百万富翁 | December456 | 26.00002 | 2788ms | 99384kb | C++14 | 1.3kb | 2024-08-07 10:23:30 | 2024-08-07 10:23:31 |
Judging History
answer
#include "richest.h"
constexpr int MAXN = 1000 + 2;
int cnt[MAXN];
int richest(int N, int T, int S) {
if (T == 1) {
for (int i = 0; i < N; i ++) {
cnt[i] = 0;
}
std::vector<int> v1, v2;
for (int i = 0; i < N; i ++) {
for (int j = i + 1; j < N; j ++) {
v1.push_back(i);
v2.push_back(j);
}
}
std::vector<int> tmp = ask(v1, v2);
for (int i = 0; i < tmp.size(); i ++) {
if (tmp[i] == v1[i]) {
cnt[v1[i]] ++;
} else {
cnt[v2[i]] ++;
}
}
for (int i = 0; i < N; i ++) {
if (cnt[i] == N - 1) {
return i;
}
}
}
std::vector<int> cur;
for (int i = 0; i < N; i ++) {
cur.push_back(i);
}
while (cur.size() > 1) {
std::vector<int> v1, v2;
for (int i = 0; i + 1 < cur.size(); i += 2) {
v1.push_back(cur[i]);
v2.push_back(cur[i + 1]);
}
int tmp = 0;
if (cur.size() & 1) {
tmp = cur.back();
}
cur = ask(v1, v2);
if (tmp) {
cur.push_back(tmp);
}
}
return cur[0];
}
详细
Pretests
Pretest #1:
score: 15
Accepted
time: 616ms
memory: 25312kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 11
Acceptable Answer
time: 2788ms
memory: 99384kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999 1811468636458994965 0.129412 3823502568050958645
result:
points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999
Final Tests
Test #1:
score: 15
Accepted
time: 627ms
memory: 25216kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 11
Acceptable Answer
time: 2683ms
memory: 99260kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999 1811468636458994965 0.129412 3823502568050958645
result:
points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999