QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#507877 | #9156. 百万富翁 | lin1991122 | 100 ✓ | 2050ms | 102136kb | C++14 | 1.2kb | 2024-08-06 22:21:39 | 2024-08-06 22:21:40 |
Judging History
answer
#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
const int N=1e6+3;
bitset<N>vis;
vector<int>work(vector<int>now,int sum){
vector<int>q1,q2,ret;
int len=now.size(),K=len/sum,rm=len%sum,i=0;
for(int T=1;T<=sum-rm;++T,i+=K)
for(int j=i;j<i+K;++j)
for(int k=j+1;k<i+K;++k)
q1.push_back(now[j]),q2.push_back(now[k]);
++K;
for(int T=1;T<=rm;++T,i+=K)
for(int j=i;j<i+K;++j)
for(int k=j+1;k<i+K;++k)
q1.push_back(now[j]),q2.push_back(now[k]);
vector<int>res=ask(q1,q2);
int sz=res.size();
for(int i=0;i<sz;++i)
if(res[i]==q1[i])vis[q2[i]]=1;
else vis[q1[i]]=1;
for(auto x:now)
if(!vis[x])ret.push_back(x);
return ret;
}
int richest(int n,int t,int s){
vis.reset();
vector<int>now;
for(int i=0;i<n;++i)now.push_back(i);
if(t==1){
now=work(now,1);
return now[0];
}
now=work(now,500000);
now=work(now,250000);
now=work(now,125000);
now=work(now,62500);
now=work(now,20833);
now=work(now,3472);
now=work(now,183);
now=work(now,1);
return now[0];
return 0;
}
详细
Pretests
Pretest #1:
score: 15
Accepted
time: 621ms
memory: 22072kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 2029ms
memory: 86508kb
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: 622ms
memory: 23496kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 2050ms
memory: 102136kb
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