QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#493256#9156. 百万富翁pengyule81.999975 4776ms88892kbC++143.3kb2024-07-26 23:00:392024-07-26 23:00:40

Judging History

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

  • [2024-07-26 23:00:40]
  • 评测
  • 测评结果:81.999975
  • 用时:4776ms
  • 内存:88892kb
  • [2024-07-26 23:00:39]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std; 
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int baoli[1005][1005],bin[20][20];
int richest(int n,int T,int S) {
	if(n==1000){
		vector<int>a,b,ret;
		for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)a.emplace_back(i),b.emplace_back(j);
		ret=ask(a,b);
		int o=0;
		for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)baoli[i][j]=(ret[o]==i),o++;
		int now=0;
		for(int i=1;i<n;i++)if(!baoli[now][i])now=i;
		return now;
	} 
	vector<int>s;
	for(int i=0;i<n;i++)s.emplace_back(i);
	shuffle(s.begin(),s.end(),rnd);
	int U=4;
	while(U--){
		vector<int>e;
		int mid=((int)s.size()+1>>1);
		vector<int>a,b,ret;
		for(int i=0;i<mid;i++){
			if(i+mid>=s.size())e.emplace_back(s[i]);
			else a.emplace_back(s[i]),b.emplace_back(s[i+mid]);
		}
		ret=ask(a,b);
		int o=0;
		for(int i=0;i<mid;i++){
			if(i+mid>=s.size())continue;
			else {
				if(ret[o]==s[i])e.emplace_back(s[i]);
				else e.emplace_back(s[i+mid]);
				o++;
			}
		}
		s=e;
	}
	{
		vector<int>a,b,ret,e;
		for(int i=0;i<s.size();i+=3){
			if(i+2<s.size()){
				a.emplace_back(s[i]),b.emplace_back(s[i+1]);
				a.emplace_back(s[i]),b.emplace_back(s[i+2]);
				a.emplace_back(s[i+1]),b.emplace_back(s[i+2]);
			}
			else if(i+1<s.size()){
				a.emplace_back(s[i]),b.emplace_back(s[i+1]);
			}
			else {
				e.emplace_back(s[i]);
			}
		}
		ret=ask(a,b);
		int o=0;
		for(int i=0;i<s.size();i+=3){
			if(i+2<s.size()){
				if(ret[o]==s[i]&&ret[o+1]==s[i])e.emplace_back(s[i]);
				else if(ret[o]==s[i+1]&&ret[o+2]==s[i+1])e.emplace_back(s[i+1]);
				else e.emplace_back(s[i+2]);
				o+=3;
			}
			else if(i+1<s.size()){
				if(ret[o]==s[i])e.emplace_back(s[i]);
				else e.emplace_back(s[i+1]);
				o++;
			}
		}
		s=e;
	}
	{
		int blo=6;
		vector<int>a,b,ret,e;
		for(int i=0;i<s.size();i+=blo){
			for(int j=i;j<min((int)s.size(),i+blo);j++)
				for(int k=j+1;k<min((int)s.size(),i+blo);k++){
					a.emplace_back(s[j]),b.emplace_back(s[k]);
				}
		} 
		ret=ask(a,b);
		int o=0;
		for(int i=0;i<s.size();i+=blo){
			int p=i;
			for(int j=i;j<min((int)s.size(),i+blo);j++)
				for(int k=j+1;k<min((int)s.size(),i+blo);k++){
					bin[j-i][k-i]=(ret[o]==s[j]);
					o++;
				}
			for(int j=i+1;j<min((int)s.size(),i+blo);j++){
				if(!bin[p-i][j-i])p=j;
			}
			e.emplace_back(s[p]);
		} 
		s=e;
	}
	cerr<<s.size()<<"||\n";
	int len=19;
	int w=(int)(s.size()+len-1)/len;
	vector<int>a,b,ret,e;
	for(int i=0;i<s.size();i+=len){
		for(int j=i;j<min((int)s.size(),i+len);j++)
			for(int k=j+1;k<min((int)s.size(),i+len);k++){
				a.emplace_back(s[j]),b.emplace_back(s[k]);
			}
	}
	ret=ask(a,b);
	int o=0;
	for(int i=0;i<s.size();i+=len){
		int p=i;
		for(int j=i;j<min((int)s.size(),i+len);j++)
			for(int k=j+1;k<min((int)s.size(),i+len);k++){
				bin[j-i][k-i]=(ret[o]==s[j]);
				o++;
			}
		for(int j=i+1;j<min((int)s.size(),i+len);j++){
			if(!bin[p-i][j-i])p=j;
		}
		e.emplace_back(s[p]);
	}
	s=e;
	a.clear(),b.clear(),ret.clear();
	n=s.size();
	for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)a.emplace_back(s[i]),b.emplace_back(s[j]);
	ret=ask(a,b);
	o=0;
	for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)baoli[i][j]=(ret[o]==s[i]),o++;
	int now=0;
	for(int i=1;i<n;i++)if(!baoli[now][i])now=i;
	return s[now];
}

詳細信息


Pretests

Pretest #1:

score: 15
Accepted
time: 623ms
memory: 29704kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 67
Acceptable Answer
time: 4770ms
memory: 88892kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960
2586970244946203279
0.788235
12006835993993373281

result:

points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960


Final Tests

Test #1:

score: 15
Accepted
time: 622ms
memory: 30796kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 67
Acceptable Answer
time: 4776ms
memory: 88300kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960
2586970244946203279
0.788235
12006835993993373281

result:

points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960