QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492308 | #9156. 百万富翁 | Felix72# | 81.999975 | 2010ms | 117880kb | C++14 | 1.4kb | 2024-07-26 11:21:23 | 2024-07-26 11:21:23 |
Judging History
answer
// 0 pts
#include <bits/stdc++.h>
#include "richest.h"
using namespace std;
const int N = 1000010;
int pos[N], cnt, nxt[N], tot, siz[N], fin[N];
int richest(int n, int t, int s)
{
if(n <= 1000)
{
vector < int > a, b, c; int cnt[1010] = {0};
for(int i = 0; i < n; ++i)
for(int j = i + 1; j < n; ++j)
a.push_back(i), b.push_back(j);
c = ask(a, b);
for(int i = 0; i < (int)c.size(); ++i) ++cnt[c[i]];
for(int i = 0; i < n; ++i) if(cnt[i] == n - 1) return i;
}
else
{
int num[10] = {0, 2, 2, 2, 2, 3, 6, 19, 183};
cnt = n;
for(int i = 1; i <= cnt; ++i) pos[i] = i - 1;
for(int i = 1; i <= 8; ++i)
{
int B = num[i];
vector < int > a, b, c;
for(int j = 0; j <= n; ++j) fin[j] = 0;
for(int l = 1; l <= cnt; ++l)
{
int r = min(l + B - 1, cnt);
// cerr << "! " << l << " " << r << '\n';
// for(int j = l; j <= r; ++j) cerr << pos[j] << " "; cerr << '\n';
for(int j = l; j <= r; ++j) siz[j] = r - l + 1;
for(int p1 = l; p1 <= r; ++p1)
for(int p2 = p1 + 1; p2 <= r; ++p2)
a.push_back(pos[p1]), b.push_back(pos[p2]);
l = r;
}
c = ask(a, b);
for(int j = 0; j < (int)c.size(); ++j) ++fin[c[j]];
tot = 0;
for(int j = 1; j <= cnt; ++j)
{
if(fin[pos[j]] == siz[j] - 1)
{
nxt[++tot] = pos[j];
}
}
cnt = tot;
for(int j = 1; j <= cnt; ++j) pos[j] = nxt[j];
}
return pos[1];
}
}
/*
1100043
2 2 2 2 3 6 19 183
*/
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 609ms
memory: 25392kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 67
Acceptable Answer
time: 2010ms
memory: 113596kb
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: 15
Accepted
time: 609ms
memory: 25272kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 67
Acceptable Answer
time: 1997ms
memory: 117880kb
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