QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#526240#9156. 百万富翁lefy68.99999 2438ms88896kbC++141.5kb2024-08-21 12:33:102024-08-21 12:33:12

Judging History

你现在查看的是最新测评结果

  • [2024-08-21 12:33:12]
  • 评测
  • 测评结果:68.99999
  • 用时:2438ms
  • 内存:88896kb
  • [2024-08-21 12:33:10]
  • 提交

answer

#include <bits/stdc++.h>
#include "richest.h"
using namespace std;
const int N=1e6+10;
int du[N];
int L[200],R[200];
int richest(int n, int T, int S){
    if(n==1000){
        for(int i=0;i<n;i++)du[i]=0;
        vector<int>a,b;
        for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++)a.push_back(i-1),b.push_back(j-1);
        a=ask(a,b);
        for(int x:a)du[x]++;
        for(int i=0;i<n;i++)if(du[i]==n-1)return i;
        return -1;
    }
    vector<int>a,b,t,t1;
    for(int i=0;i<n;i++)t.push_back(i);
    for(int c=1;c<=8;c++){
        int sz=t.size(),tmp=-1;
        if(sz&1)tmp=t[sz/2];
        a.clear(),b.clear();
        for(int i=0;i<sz/2;i++)a.push_back(t[i]),b.push_back(t[sz-i-1]);
        t=ask(a,b);
        
        if(tmp!=-1)t.push_back(tmp);
    }
    t1=t;int nn=n;
    for(int i=0;i<nn;i++)du[i]=0;
    n=t.size();a.clear(),b.clear();
    int s=ceil(1.0*n/128);R[0]=-1;
    for(int i=1;i<=128;i++){
        L[i]=R[i-1]+1,R[i]=min(n-1,L[i]+s-1);
        for(int j=L[i];j<=R[i];j++)for(int k=j+1;k<=R[i];k++)a.push_back(t[j]),b.push_back(t[k]);
    }
    t=ask(a,b);
    for(int x:t)du[x]++;
    a.clear(),b.clear();t.clear();
    for(int i=1;i<=128;i++){
        int len=R[i]-L[i];
        for(int j=L[i];j<=R[i];j++)if(du[t1[j]]==len)t.push_back(t1[j]);
    }
    for(int i=0;i<nn;i++)du[i]=0;
    n=t.size();
    for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)a.push_back(t[i]),b.push_back(t[j]);
    t=ask(a,b);
    for(int x:t)du[x]++;
    for(int x:t)if(du[x]==n-1)return x;
    return -1;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 633ms
memory: 27284kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 54
Acceptable Answer
time: 2401ms
memory: 88896kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1062684
10225584555355237899
0.635294
4439523384460221017

result:

points 0.635294 Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1062684


Final Tests

Test #1:

score: 15
Accepted
time: 637ms
memory: 27208kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 54
Acceptable Answer
time: 2438ms
memory: 88828kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1062684
10225584555355237899
0.635294
4439523384460221017

result:

points 0.635294 Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1062684