QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#689015#9156. 百万富翁sunkaihuan100 ✓2985ms109636kbC++14742b2024-10-30 14:53:212024-10-30 14:53:21

Judging History

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

  • [2024-10-30 14:53:21]
  • 评测
  • 测评结果:100
  • 用时:2985ms
  • 内存:109636kb
  • [2024-10-30 14:53:21]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
const int V=1e6+1;
int ix[V],nw[V],cl,cr;
vector<int> qla,qlb,an;bool v[V];
int l[10]={V/2,V/4,V/8,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++){
		for(int j=0;j<V;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: 823ms
memory: 28240kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2985ms
memory: 109616kb

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: 817ms
memory: 29464kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2776ms
memory: 109636kb

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