QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#499536#9156. 百万富翁sunkaihuan100 ✓2626ms109812kbC++14781b2024-07-31 15:28:592024-07-31 15:29:01

Judging History

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

  • [2024-07-31 15:29:01]
  • 评测
  • 测评结果:100
  • 用时:2626ms
  • 内存:109812kb
  • [2024-07-31 15:28:59]
  • 提交

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 l[10]={500000,250000,125000,62496,20832,3472,183,1};

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

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 828ms
memory: 28372kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2626ms
memory: 109768kb

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: 816ms
memory: 27328kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2531ms
memory: 109812kb

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