QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#492697#9156. 百万富翁Dawnq100 ✓3006ms87116kbC++141.1kb2024-07-26 15:21:062024-07-26 15:21:07

Judging History

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

  • [2024-07-26 15:21:07]
  • 评测
  • 测评结果:100
  • 用时:3006ms
  • 内存:87116kb
  • [2024-07-26 15:21:06]
  • 提交

answer

#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
const int N=1e6+5;
int n,A[N],Cnt;
int num[35]={500000,250000,125000,62500,20833,3472,183,1};
int richest(int n,int s,int t){
    vector<int>a,b,c;
    if(n==1000){
        for(int i=0;i<n;++i){
            for(int j=i+1;j<n;++j)a.push_back(i),b.push_back(j);
        }
        c=ask(a,b);
        vector<int>rd(n,0);
        for(int i=0;i<499500;++i){
            if(c[i]==a[i])++rd[b[i]];
            else ++rd[a[i]];
        }
        for(int i=0;i<n;++i)if(!rd[i])return i;
    }
    vector<int>p(n);
    for(int i=0;i<n;++i)p[i]=i;
    for(int i=0;i<8;++i){
        a.clear(),b.clear();
		for(int j=0;j<(int)p.size();++j){
			for(int k=j%num[i];k<j;k+=num[i])if(j!=k)a.push_back(p[j]),b.push_back(p[k]);
		}
        vector<int>c=ask(a,b),q,rd(n,0);
        for(int j=0;j<(int)c.size();++j){
            if(c[j]==a[j])++rd[b[j]];
            else ++rd[a[j]];
        }
        for(int j=0;j<(int)p.size();++j)if(!rd[p[j]])q.push_back(p[j]);
        p=q;
	}
    return p[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 639ms
memory: 25388kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 3006ms
memory: 86836kb

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: 642ms
memory: 25376kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2903ms
memory: 87116kb

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