QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492226 | #9156. 百万富翁 | zwh2008# | 26.00002 | 4657ms | 95340kb | C++14 | 836b | 2024-07-26 10:36:17 | 2024-07-26 10:36:19 |
Judging History
answer
#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
mt19937 rd(5384);
int richest(int n,int T,int S) {
if(T==1) {
vector<int>a,b,ct(n);
for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)a.push_back(i),b.push_back(j);
vector<int>c=ask(a,b);
for(int i:c)ct[i]++;
for(int i=0;i<n;i++)if(ct[i]==n-1)return i;
}
vector<int>a(n);
iota(a.begin(),a.end(),0);
while(a.size()>1) {
shuffle(a.begin(),a.end(),rd);
vector<int>qa,qb,qc,na,del(a.size());
for(int i=0;i+1<a.size();i+=2)qa.push_back(a[i]),qb.push_back(a[i+1]);
qc=ask(qa,qb);
for(int i=0;i<qc.size();i++)if(qc[i]==qa[i])del[i*2+1]=1;else del[i*2]=1;
for(int i=0;i<a.size();i++)if(!del[i])na.push_back(a[i]);
a=na;
}
return a[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 615ms
memory: 21832kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 11
Acceptable Answer
time: 4657ms
memory: 95288kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999 1811468636458994965 0.129412 3823502568050958645
result:
points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999
Final Tests
Test #1:
score: 15
Accepted
time: 633ms
memory: 23164kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 11
Acceptable Answer
time: 4432ms
memory: 95340kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999 1811468636458994965 0.129412 3823502568050958645
result:
points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999