QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#613912 | #9156. 百万富翁 | SwordDance | 15 | 627ms | 86020kb | C++14 | 2.0kb | 2024-10-05 15:02:28 | 2024-10-05 15:07:33 |
Judging History
answer
#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
bool out[1000003];
int a[1000003],p[10]={0,2,2,2,2,3,6,19,181},yu[10]={0,0,0,0,0,20832,3471,168,0};
int richest(int n, int T, int s) {
vector<int>v1,v2,ans;
for(int i=0;i<n;i++) out[i]=0;
if(T==1){
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++){
v1.emplace_back(i);
v2.emplace_back(j);
}
ans=ask(v1,v2);
int num=0;
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++){
if(ans[num++]==i) out[j]=1;
else out[i]=1;
}
for(int i=0;i<n;i++) if(!out[i]) return i;
}
for(int i=1;i<=8;i++){
int num=0,cnt=0;
for(int j=0;j<n;j++){
if(out[j]) continue;
a[++num]=j;
if(num>=p[i]&&(cnt<=yu[i]||num>p[i]||yu[i]==0)){
//if(num>3)for(int k=1;k<=num;k++) cout<<a[k]<<' ';if(num>3) cout<<endl<<endl;
for(int k=1;k<=num;k++)
for(int l=k+1;l<=num;l++){
v1.emplace_back(a[k]);
v2.emplace_back(a[l]);
}
num=0;
cnt++;
}
}
if(num){
for(int k=1;k<=num;k++)
for(int l=k+1;l<=num;l++){
v1.emplace_back(a[k]);
v2.emplace_back(a[l]);
}
num=0;
}
ans=ask(v1,v2);
int now=0;num=cnt=0;
for(int j=0;j<n;j++){
if(out[j]) continue;
a[++num]=j;
if(num>=p[i]&&(cnt<=yu[i]||num>p[i]||yu[i]==0)){
for(int k=1;k<=num;k++)
for(int l=k+1;l<=num;l++){
if(ans[now++]==a[k]) out[a[l]]=1;
else out[a[k]]=1;
}
num=0;
cnt++;
}
}
if(num){
for(int k=1;k<=num;k++)
for(int l=k+1;l<=num;l++){
if(ans[now++]==a[k]) out[a[l]]=1;
else out[a[k]]=1;
}
num=0;
}
v1.clear(),v2.clear(),ans.clear();
}
//cout<<"ans:";for(int i=0;i<n;i++) if(!out[i]) cout<<i<<' ';cout<<endl;
for(int i=0;i<n;i++) if(!out[i]) return i;
return 114514;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 617ms
memory: 27372kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Wrong Answer
time: 265ms
memory: 86020kb
input:
1000000 20 2000000 29091473
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Final Tests
Test #1:
score: 15
Accepted
time: 627ms
memory: 27176kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Wrong Answer
time: 246ms
memory: 85652kb
input:
1000000 20 2000000 29091471
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer