QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492358 | #9156. 百万富翁 | leihonglongyin# | 51.99999 | 3730ms | 101504kb | C++14 | 2.0kb | 2024-07-26 11:37:48 | 2024-07-26 11:37:48 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
using namespace std;mt19937 R(time(0));
vector<int>now,a,b,tmp,to;map<int,int>cnt;int tot;
void sol0(){cnt.clear(),a.clear(),b.clear(),tot++;int len=now.size();
for(int i=0;i<len;i++)for(int j=i+1;j<len;j++)
a.push_back(now[i]),b.push_back(now[j]);
tmp=ask(a,b),now.resize(1);for(auto i:tmp)cnt[i]++;
for(auto i:cnt)if(i.second==len-1)return now[0]=i.first,void();
}
void sol1(){
while(tot<3){a.clear(),b.clear();int lst=0;
shuffle(now.begin(),now.end(),R),tot++;
for(int i=0;i+1<now.size();i+=2)a.push_back(now[i]),b.push_back(now[i+1]);
if(now.size()&1)lst=now.back();
now=ask(a,b);if(lst)now.push_back(lst);
}cerr<<now.size()<<"\n";
}
void sol2(){
while(tot<6){a.clear(),b.clear(),tmp.clear(),to.clear();
shuffle(now.begin(),now.end(),R),tot++;
for(int i=0;i+1<now.size();i++)a.push_back(now[i]),b.push_back(now[i+1]);
a.push_back(now[0]),b.push_back(now.back()),tmp=ask(a,b);
for(int i=0;i<now.size();i++){
if(tmp[i?i-1:now.size()-1]==tmp[i]&&tmp[i]==now[i])to.push_back(now[i]);
}now=to;
}cerr<<now.size()<<"\n";
}
void sol3(){
while(tot<8){a.clear(),b.clear(),tmp.clear(),to.clear();
shuffle(now.begin(),now.end(),R),tot++;
int len=5;len=max(len,2);
vector<int>id(now.size());
for(int i=0;i<now.size();i++)id[i]=i/len+1;
for(int i=0;i<=id.back();i++){
int l=i*len,r=min(i*len+len,(int)now.size())-1;
for(int x=l;x<=r;x++)for(int y=x+1;y<=r;y++)
a.push_back(now[x]),b.push_back(now[y]);
}tmp=ask(a,b);int num=0;
for(int i=0;i<=id.back();i++){cnt.clear();
int l=i*len,r=min(i*len+len,(int)now.size())-1;
for(int x=l;x<=r;x++)for(int y=x+1;y<=r;y++)
cnt[tmp[num++]]++;
for(int j=l;j<=r;j++)if(cnt[now[j]]==r-l)to.push_back(now[j]);
}now=to;
}cerr<<now.size()<<"\n";
}
int richest(int N,int T,int S){now.clear(),tot=0;
if(T==1){for(int i=0;i<N;i++)now.push_back(i);return sol0(),now[0];}
for(int i=0;i<N;i++)now.push_back(i);
return sol1(),sol2(),sol3(),sol0(),now[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 759ms
memory: 24268kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 37
Acceptable Answer
time: 3709ms
memory: 101480kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 37 / 85, maxt = 9, maxs = 1116018 3135854385879394747 0.435294 13281437197936769557
result:
points 0.435294 Partially correct Case 2, 37 / 85, maxt = 9, maxs = 1116018
Final Tests
Test #1:
score: 15
Accepted
time: 754ms
memory: 22520kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 37
Acceptable Answer
time: 3730ms
memory: 101504kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 37 / 85, maxt = 9, maxs = 1115947 8219983790389288591 0.435294 13281437197936769557
result:
points 0.435294 Partially correct Case 2, 37 / 85, maxt = 9, maxs = 1115947