QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#527892 | #9156. 百万富翁 | bashkort | 100 ✓ | 2096ms | 86456kb | C++20 | 1.2kb | 2024-08-22 21:49:11 | 2024-08-22 21:49:12 |
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{500000,250000,125000,62500,20833,3472,183,1};
if (T == 1) {
types = {1};
}
vector<int> a(N);
iota(a.begin(), a.end(), 0);
for (int x : types) {
int n = a.size();
if (x > n) {
continue;
}
vector<int> ax, ay;
for (int i = 0, g = 0; i < n; ++g) {
int siz = n / x + (n % x > g);
for (int j = i; j < i + siz; ++j) {
for (int z = j + 1; z < i + siz; ++z) {
ax.push_back(a[j]);
ay.push_back(a[z]);
}
}
i += siz;
}
auto az = ask(ax, ay);
vector<int> del(N);
for (int i = 0; i < ax.size(); ++i) {
del[ax[i] ^ ay[i] ^ az[i]] = true;
}
vector<int> nxt;
for (int i : a) {
if (!del[i]) {
nxt.push_back(i);
}
}
a = nxt;
if (a.size() == 1) {
break;
}
}
return a[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 603ms
memory: 23452kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 2096ms
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: 593ms
memory: 22012kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 2081ms
memory: 86456kb
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