QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#492661#9156. 百万富翁leihonglongyin91.00003 3995ms95808kbC++141.3kb2024-07-26 14:59:542024-07-26 14:59:55

Judging History

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

  • [2024-07-26 14:59:55]
  • 评测
  • 测评结果:91.00003
  • 用时:3995ms
  • 内存:95808kb
  • [2024-07-26 14:59:54]
  • 提交

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,int x){
	while(tot<x){a.clear(),b.clear(),tmp.clear(),to.clear();
    	shuffle(now.begin(),now.end(),R),tot++;vector<int>id;
    	int Len=now.size()/len;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(2,4),sol1(3,5),sol1(6,6),sol1(19,7);
	return sol0(),now[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 748ms
memory: 24412kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 76
Acceptable Answer
time: 3995ms
memory: 95688kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947
708834003727782761
0.894118
11625001216319896173

result:

points 0.894118 Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947


Final Tests

Test #1:

score: 15
Accepted
time: 742ms
memory: 22488kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 76
Acceptable Answer
time: 3965ms
memory: 95808kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947
708834003727782761
0.894118
11625001216319896173

result:

points 0.894118 Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947