QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#492666#9156. 百万富翁leihonglongyin100 ✓4647ms95784kbC++141.3kb2024-07-26 15:03:072024-07-26 15:03:08

Judging History

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

  • [2024-07-26 15:03:08]
  • 评测
  • 测评结果:100
  • 用时:4647ms
  • 内存:95784kb
  • [2024-07-26 15:03:07]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;mt19937 R(time(0));
vector<int>now,a,b,tmp,to;map<int,int>cnt;int tot,Tot;
void sol0(){cnt.clear(),a.clear(),b.clear();int len=now.size();
	for(int i=0;i<len;i++)for(int j=i+1;j<len;j++)
		a.push_back(now[i]),b.push_back(now[j]);
	tmp=ask(a,b),now.resize(1);for(auto i:tmp)cnt[i]++;
	for(auto i:cnt)if(i.second==len-1)return now[0]=i.first,void();
}
void sol1(int len){
	a.clear(),b.clear(),tmp.clear(),to.clear();
	shuffle(now.begin(),now.end(),R),tot++;vector<int>id;
	for(int i=0;i<len;i++)id.push_back(now.size()/len);
	int sy=now.size()%len;for(int i=0;i<sy;i++)id[i]++;
	for(int l=0,r,i=0;i<id.size();l=r+1,i++){r=l+id[i]-1; 
		for(int x=l;x<=r;x++)for(int y=x+1;y<=r;y++)
			a.push_back(now[x]),b.push_back(now[y]);
	}Tot+=a.size(),tmp=ask(a,b);int num=0;
	for(int l=0,r,i=0;i<id.size();l=r+1,i++){cnt.clear(),r=l+id[i]-1; 
		for(int x=l;x<=r;x++)for(int y=x+1;y<=r;y++)
			cnt[tmp[num++]]++;
		for(int j=l;j<=r;j++)if(cnt[now[j]]==r-l)to.push_back(now[j]);
	}now=to;
}
int richest(int N,int T,int S){now.clear(),Tot=tot=0;
	if(T==1){for(int i=0;i<N;i++)now.push_back(i);return sol0(),now[0];}
	for(int i=0;i<N;i++)now.push_back(i);
	sol1(5e5),sol1(2.5e5),sol1(1.25e5),sol1(62497);
	sol1(20832),sol1(3472),sol1(183);
	return sol0(),now[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 749ms
memory: 24280kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 4647ms
memory: 95708kb

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: 758ms
memory: 22564kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 4611ms
memory: 95784kb

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