QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#490282#9156. 百万富翁staring68.99999 1991ms100312kbC++232.3kb2024-07-25 14:00:172024-07-25 14:00:18

Judging History

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

  • [2024-07-25 14:00:18]
  • 评测
  • 测评结果:68.99999
  • 用时:1991ms
  • 内存:100312kb
  • [2024-07-25 14:00:17]
  • 提交

answer

#include "richest.h"

int richest(int N,int T,int S)
{
    if(N==1000)
    {
        std::vector<int> a,b;
        for(int i=0;i<N;i++)
            for(int j=i+1;j<N;j++)a.push_back(i),b.push_back(j);
        auto c=ask(a,b);

        int res=0;
        for(int i=0,k=0;i<N;i++)
            for(int j=i+1;j<N;j++,k++)
                if((res==a[k]||res==b[k])&&res!=c[k])res=c[k];
        return res;
    }

    std::vector<int> a,b,c;
    for(int i=0;i<N;i++)c.push_back(i);

    for(int i=1;i<=6;i++)
    {
        std::vector<int>().swap(a),std::vector<int>().swap(b);
        for(int i=0;i+1<c.size();i+=2)a.push_back(c[i]),b.push_back(c[i+1]);
        c=ask(a,b);
    }

    int back=c.back();c.pop_back();
    std::vector<int>().swap(a),std::vector<int>().swap(b);
    for(int i=0;i+1<c.size();i+=2)a.push_back(c[i]),b.push_back(c[i+1]);
    c=ask(a,b);
    std::vector<int>().swap(a),std::vector<int>().swap(b);
    for(int i=0;i+1<c.size();i+=2)a.push_back(c[i]),b.push_back(c[i+1]);
    c=ask(a,b);
    c.push_back(back);

    {
        int last=c.size()%20,cnt=c.size()/20,idx=0;
        std::vector<int>().swap(a),std::vector<int>().swap(b);
        for(int u=1;u<=cnt;u++)
        {
            for(int i=0;i<=19;i++)
                for(int j=i+1;j<=19;j++)a.push_back(c[idx+i]),b.push_back(c[idx+j]);
            idx+=20;
        }
        for(int i=0;i<last;i++)
            for(int j=i+1;j<last;j++)a.push_back(c[idx+i]),b.push_back(c[idx+j]);
        auto tmp=ask(a,b);
        std::vector<int>().swap(c),idx=0;
        int k=0;
        for(int u=1;u<=cnt;u++)
        {
            int res=tmp[k];
            for(int i=0;i<=19;i++)
                for(int j=i+1;j<=19;j++,k++)
                    if((res==a[k]||res==b[k])&&res!=tmp[k])res=tmp[k];
            idx+=20,c.push_back(res);
        }
        int res=tmp[k];
        for(int i=0;i<last;i++)
            for(int j=i+1;j<last;j++,k++)
                if((res==a[k]||res==b[k])&&res!=tmp[k])res=tmp[k];
        c.push_back(res);
    }

    std::vector<int>().swap(a),std::vector<int>().swap(b);
    for(int i=0;i<c.size();i++)
        for(int j=i+1;j<c.size();j++)a.push_back(c[i]),b.push_back(c[j]);
    c=ask(a,b);
    int res=c[0];
    for(int i=0;i<c.size();i++)
        if((res==a[i]||res==b[i])&&res!=c[i])res=c[i];
    return res;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 607ms
memory: 25476kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 54
Acceptable Answer
time: 1991ms
memory: 100312kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1052274
8446452163159234479
0.635294
4439523384460221017

result:

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


Final Tests

Test #1:

score: 15
Accepted
time: 614ms
memory: 25328kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 54
Acceptable Answer
time: 1985ms
memory: 84628kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1052274
8446452163159234479
0.635294
4439523384460221017

result:

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