QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#492408 | #9156. 百万富翁 | leihonglongyin# | 77.99996 | 4036ms | 95332kb | C++14 | 1.4kb | 2024-07-26 12:01:03 | 2024-07-26 12:01:03 |
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,Tot;
void sol0(){cnt.clear(),a.clear(),b.clear();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(int len,int x){
while(tot<x){a.clear(),b.clear(),tmp.clear(),to.clear();
shuffle(now.begin(),now.end(),R),tot++;
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]);
}Tot+=a.size(),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()<<" "<<Tot<<"\n";
}
int richest(int N,int T,int S){now.clear(),Tot=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);
sol1(2,3),sol1(3,5),sol1(6,6),sol1(10,8);
return sol0(),now[0];
}
詳細信息
Pretests
Pretest #1:
score: 15
Accepted
time: 738ms
memory: 24416kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 63
Acceptable Answer
time: 4036ms
memory: 95332kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1088103 4292432757691463039 0.741176 16601290867448354019
result:
points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1088103
Final Tests
Test #1:
score: 15
Accepted
time: 745ms
memory: 22644kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 63
Acceptable Answer
time: 3995ms
memory: 95188kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1088103 4292432757691463039 0.741176 16601290867448354019
result:
points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1088103