QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#509916#9156. 百万富翁TlenekWodoru#100 ✓2991ms103188kbC++142.7kb2024-08-08 19:44:352024-08-08 19:44:36

Judging History

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

  • [2024-08-08 19:44:36]
  • 评测
  • 测评结果:100
  • 用时:2991ms
  • 内存:103188kb
  • [2024-08-08 19:44:35]
  • 提交

answer

#include <bits/stdc++.h>
#include "richest.h"
using namespace std;
vector<int>Kto1={2,2,2,2,3,6,19,183};
vector<int>Kto2={0,0,0,3,0,0,18,0};
vector<int>Ile= {0,0,0,8,0,0,4,0};
bool CzyJestGit[1000000];
int richest(int n, int T, int S)
{
    if(n==1000)
    {
        for(int i=0;i<n;i++)
        {
            CzyJestGit[i]=1;
        }
        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);
            }
        }
        vector<int>W=ask(A,B);
        for(int i=0;i<A.size();i++)
        {
            if(W[i]==A[i])
            {
                CzyJestGit[B[i]]=0;
            }
            else
            {
                CzyJestGit[A[i]]=0;
            }
        }
        for(int i=0;i<n;i++)
        {
            if(CzyJestGit[i])
            {
                return i;
            }
        }
    }
    vector<int>Kand;
    for(int i=0;i<n;i++)
    {
        Kand.push_back(i);
    }
    for(int I=0;I<8;I++)
    {
        if(Kand.size()==1){break;}
        for(int u : Kand)
        {
            CzyJestGit[u]=1;
        }
        vector<vector<int>>U;
        for(int i=1;i<=Ile[I];i++)
        {
            vector<int>Temp;
            if(Kand.size()<Kto2[I]){break;}
            for(int j=1;j<=Kto2[I];j++)
            {
                Temp.push_back(Kand.back());
                Kand.pop_back();
            }
            U.push_back(Temp);
        }
        while(Kand.size()>=Kto1[I])
        {
            vector<int>Temp;
            for(int j=1;j<=Kto1[I];j++)
            {
                Temp.push_back(Kand.back());
                Kand.pop_back();
            }
            U.push_back(Temp);
        }
        if(Kand.size()>0)
        {
            U.push_back(Kand);
            Kand.clear();
        }
        vector<int>A,B;
        for(vector<int>Temp : U)
        {
            for(int a=0;a<Temp.size();a++)
            {
                for(int b=a+1;b<Temp.size();b++)
                {
                    A.push_back(Temp[a]);
                    B.push_back(Temp[b]);
                }
            }
        }
        vector<int>W=ask(A,B);
        for(int i=0;i<A.size();i++)
        {
            if(W[i]==A[i])
            {
                CzyJestGit[B[i]]=0;
            }
            else
            {
                CzyJestGit[A[i]]=0;
            }
        }
        for(int i=0;i<n;i++)
        {
            if(CzyJestGit[i])
            {
                Kand.push_back(i);
            }
        }
    }
    return Kand[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 617ms
memory: 25220kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2991ms
memory: 103188kb

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: 617ms
memory: 25420kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2990ms
memory: 103120kb

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