QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492998 | #9156. 百万富翁 | dyj133446 | 100 ✓ | 2191ms | 87428kb | C++14 | 1.1kb | 2024-07-26 18:12:35 | 2024-07-26 18:12:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#include "richest.h"
bool vis[1000005];
int richest(int N, int T, int S) {
if(N<=1000)
{
memset(vis,0,sizeof(vis));
vector<int>a,b,c;
for(int i=0;i<N;i++)
{
for(int j=i+1;j<N;j++)a.emplace_back(i),b.emplace_back(j);
}
c=ask(a,b);
int tot=0;
for(int i=0;i<N;i++)
{
for(int j=i+1;j<N;j++)
{
if(c[tot]==i)vis[j]=1;
else vis[i]=1;
tot++;
}
}
for(int i=0;i<N;i++)if(!vis[i])return i;
}
memset(vis,0,sizeof(vis));
int f[10];
f[1]=500000,f[2]=250000,f[3]=125000,f[4]=62500,f[5]=20832,f[6]=3472,f[7]=183,f[8]=1;
for(int i=1;i<=8;i++)
{
vector<int>v,a,b,c;
for(int j=0;j<N;j++)if(!vis[j])v.emplace_back(j);
int x=v.size()/f[i],y=v.size()%f[i],sum=0;
for(int K=1;K<=f[i];K++)
{
int cnt=x;
if(K<=y)cnt++;
for(int j=0;j<cnt;j++)
{
for(int k=j+1;k<cnt;k++)a.emplace_back(v[sum+j]),b.emplace_back(v[sum+k]);
}
sum+=cnt;
}
c=ask(a,b);
for(int j=0;j<c.size();j++)
{
if(c[j]==a[j])vis[b[j]]=1;
else vis[a[j]]=1;
}
}
for(int i=0;i<N;i++)if(!vis[i])return i;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 632ms
memory: 26352kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 2080ms
memory: 87396kb
input:
1000000 20 2000000 29091473
output:
Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944 7610580723948932399 1.000000 1331569654267968081
result:
points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
Final Tests
Test #1:
score: 15
Accepted
time: 622ms
memory: 27752kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 2191ms
memory: 87428kb
input:
1000000 20 2000000 29091471
output:
Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944 7610580723948932399 1.000000 1331569654267968081
result:
points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944