QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#492284 | #9156. 百万富翁 | leihonglongyin# | 0 | 3959ms | 116244kb | C++14 | 1.3kb | 2024-07-26 11:08:01 | 2024-07-26 11:08:05 |
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();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){
while(now.size()>len){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);
}
}
void sol2(int len){
while(now.size()>len){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;
}
}
void sol3(int len){
}
int richest(int N,int T,int S){now.clear();
if(T==1)return sol0(),now[0];
for(int i=0;i<N;i++)now.push_back(i);
tot=0;
sol1(2e5);
sol2(200);
cout<<tot<<"\n";
sol0();
return now[0];
}
詳細信息
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 1ms
memory: 8024kb
input:
1000 1 499500 957319859
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Pretest #2:
score: 0
Wrong Answer
time: 3959ms
memory: 116244kb
input:
1000000 20 2000000 29091473
output:
Unauthorized output
result:
points 0.0 Invalid signature
Final Tests
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 8092kb
input:
1000 1 499500 957319857
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Test #2:
score: 0
Wrong Answer
time: 3867ms
memory: 105340kb
input:
1000000 20 2000000 29091471
output:
Unauthorized output
result:
points 0.0 Invalid signature