QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#488952 | #9156. 百万富翁 | chy_is_a_fish | 100 ✓ | 2074ms | 136684kb | C++14 | 1.4kb | 2024-07-24 16:38:41 | 2024-07-24 16:38:42 |
Judging History
answer
#include <bits/stdc++.h>
#include "richest.h"
using namespace std;
const int N = 1e6 + 5;
vector <int> vec[N], num, ret, q1, q2;
int tot[N];
void work(int p, int q, int c)
{
memset(tot, 0, sizeof(tot));
q1.clear(); q2.clear(); int cnt = 0;
for (int i = 1; i <= c; i++)
{
cnt++; vec[cnt].clear();
for (int j = 1; j <= q; j++)
vec[cnt].push_back(num.back()), num.pop_back();
for (int i = 0; i < q; i++)
for (int j = i + 1; j < q; j++)
q1.push_back(vec[cnt][i]), q2.push_back(vec[cnt][j]);
}
while (!num.empty())
{
cnt++; vec[cnt].clear();
for (int j = 1; j <= p; j++)
vec[cnt].push_back(num.back()), num.pop_back();
for (int i = 0; i < p; i++)
for (int j = i + 1; j < p; j++)
q1.push_back(vec[cnt][i]), q2.push_back(vec[cnt][j]);
}
ret = ask(q1, q2);
for (int x : ret) tot[x]++;
for (int i = 1; i <= cnt; i++) for (int x : vec[i])
if (tot[x] == (int)vec[i].size() - 1) num.push_back(x);
}
int richest(int n, int T, int S)
{
num.clear();
for (int i = 0; i < n; i++) num.push_back(i);
if (T == 1) return work(n, 0, 0), num[0];
for (int _ = 1; _ <= 4; _++) work(2, 0, 0);
work(3, 4, 1); work(6, 7, 1);
work(19, 18, 5); work(183, 0, 0);
return num[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 614ms
memory: 52516kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 2027ms
memory: 136684kb
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: 595ms
memory: 51716kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 2074ms
memory: 129240kb
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