QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#499375#9156. 百万富翁sunkaihuan#24.999995 2953ms106176kbC++141022b2024-07-31 13:28:322024-07-31 13:28:33

Judging History

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

  • [2024-07-31 13:28:33]
  • 评测
  • 测评结果:24.999995
  • 用时:2953ms
  • 内存:106176kb
  • [2024-07-31 13:28:32]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
int ix[1000005],nw[1000005],cl,cr;
vector<int> qla,qlb,an;bool v[1000005];

int richest(int N, int T, int S) {
	for(int i=0;i<=1000000;i++)v[i]=0;
	cl=N;for(int i=1;i<=N;i++)ix[i]=i-1;
	for(int i=1;i<=(T==1?0:8);i++){
		if(cl==1)return ix[cl];
		qla.clear();qlb.clear();
		for(int j=1;j<cl;j++)
			qla.push_back(ix[j]),qlb.push_back(ix[j+1]);
		an=ask(qla,qlb);cr=0;
		for(int j=1;j<=cl;j++){
			if(j==1&&an[0]==ix[1]||j==cl&&an[cl-2]==ix[cl])nw[++cr]=ix[j];
			if(1<j&&j<cl&&an[j-2]==ix[j]&&an[j-1]==ix[j])nw[++cr]=ix[j];
		}for(int j=1;j<=cr;j++)ix[j]=nw[j];cl=cr;
		//for(int j=1;j<=cl;j++)cout<<ix[j]<<" ";cout<<"\n";
	}if(cl==1)return ix[cl];
	qla.clear();qlb.clear();
	for(int i=1;i<=cl;i++)
		for(int j=i+1;j<=cl;j++)
			qla.push_back(ix[i]),qlb.push_back(ix[j]);
	an=ask(qla,qlb);cr=0;
	for(int i=1;i<=cl;i++)
		for(int j=i+1;j<=cl;j++)
			v[ix[i]+ix[j]-an[cr++]]=1;
	for(int i=1;i<=cl;i++)if(!v[ix[i]])return ix[i];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 618ms
memory: 28316kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 10
Acceptable Answer
time: 2953ms
memory: 106100kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 10 / 85, maxt = 9, maxs = 1672633
1333634141005938973
0.117647
16061364853332744819

result:

points 0.117647 Partially correct Case 2, 10 / 85, maxt = 9, maxs = 1672633


Final Tests

Test #1:

score: 15
Accepted
time: 619ms
memory: 28736kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 10
Acceptable Answer
time: 2849ms
memory: 106176kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 10 / 85, maxt = 9, maxs = 1673264
7150802312007861919
0.117647
16061364853332744819

result:

points 0.117647 Partially correct Case 2, 10 / 85, maxt = 9, maxs = 1673264