QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#526466 | #9156. 百万富翁 | bashkort# | 66.999975 | 1941ms | 97556kb | C++20 | 2.3kb | 2024-08-21 16:34:07 | 2024-08-21 16:34:07 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int richest(int N, int T, int S) {
vector<int> types{0, 0, 0, 0, 3, 6, 19, -1};
vector<int> a(N);
iota(a.begin(), a.end(), 0);
for (int x : types) {
int n = a.size();
if (x == 0) {
vector<int> u, v;
for (int i = 0; i < n; ++i) {
(i % 2 ? v : u).push_back(a[i]);
}
int add = -1;
if (u.size() > v.size()) {
add = u.back();
u.pop_back();
}
vector<int> res = ask(u, v);
if (add != -1) {
res.push_back(add);
}
a = res;
} else if (x == -1) {
vector<int> u, v;
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
u.push_back(a[i]);
v.push_back(a[j]);
}
}
vector<int> res = ask(u, v);
vector<int> cnt(N + 1);
for (int &t : res) {
cnt[t] += 1;
}
for (int t : a) {
if (cnt[t] == n - 1) {
return t;
}
}
assert(false);
return -1;
} else {
int g = x;
vector<int> u, v;
for (int i = 0; i < n; ++i) {
int nx = min(n, i / g * g + g);
for (int j = i + 1; j < nx; ++j) {
u.push_back(a[i]);
v.push_back(a[j]);
}
}
vector<int> res = ask(u, v);
vector<int> cnt(N + 1), pos(N + 1, -1);
for (int &t : res) {
cnt[t] += 1;
}
for (int i = 0; i < n; ++i) {
pos[a[i]] = i;
}
vector<int> l;
int c = n / g;
for (int t : a) {
if (cnt[t] == g - 1) {
l.push_back(t);
} else if (pos[t] / g >= c && cnt[t] == n % g - 1) {
l.push_back(t);
}
}
a = l;
}
if (a.size() == 1) {
break;
}
}
return a[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 0ms
memory: 8172kb
input:
1000 1 499500 957319859
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Pretest #2:
score: 67
Acceptable Answer
time: 1913ms
memory: 86724kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960 2586970244946203279 0.788235 12006835993993373281
result:
points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960
Final Tests
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 8168kb
input:
1000 1 499500 957319857
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Test #2:
score: 67
Acceptable Answer
time: 1941ms
memory: 97556kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960 2586970244946203279 0.788235 12006835993993373281
result:
points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960