QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#492277 | #9156. 百万富翁 | C1942huangjiaxu | 100 ✓ | 2017ms | 96360kb | C++14 | 756b | 2024-07-26 11:06:25 | 2024-07-26 11:06:27 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
bool ban[1000005];
int p[10]={500000,250000,125000,62500,20833,3472,183,1};
int solve(vector<int>A,int d){
int m=A.size();
if(m==1)return A[0];
vector<int>a,b,c,B;
int d1=m/p[d],d2=m%p[d];
for(int i=0,c=1;i<m;++c,++i){
int r=i+d1-(c>d2);
for(int j=i;j<r;++j)for(int k=j+1;k<=r;++k)a.push_back(A[j]),b.push_back(A[k]);
i=r;
}
c=ask(a,b);
for(auto v:A)ban[v]=false;
for(int i=0;i<a.size();++i){
if(c[i]!=a[i])ban[a[i]]=true;
if(c[i]!=b[i])ban[b[i]]=true;
}
for(auto v:A)if(!ban[v])B.push_back(v);
return solve(B,d+1);
}
int richest(int n, int T, int S){
if(n<=1000)p[0]=1;
vector<int>A(n);
iota(A.begin(),A.end(),0);
return solve(A,0);
}
详细
Pretests
Pretest #1:
score: 15
Accepted
time: 631ms
memory: 21460kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 2016ms
memory: 96328kb
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: 631ms
memory: 23764kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 2017ms
memory: 96360kb
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