QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#492354#9156. 百万富翁leihonglongyin#53.000015 3836ms101524kbC++142.0kb2024-07-26 11:35:392024-07-26 11:35:40

Judging History

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

  • [2024-07-26 11:35:40]
  • 评测
  • 测评结果:53.000015
  • 用时:3836ms
  • 内存:101524kb
  • [2024-07-26 11:35:39]
  • 提交

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;
void sol0(){cnt.clear(),a.clear(),b.clear(),tot++;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(){
	while(tot<3){a.clear(),b.clear();int lst=0;
		shuffle(now.begin(),now.end(),R),tot++;
		for(int i=0;i+1<now.size();i+=2)a.push_back(now[i]),b.push_back(now[i+1]);
		if(now.size()&1)lst=now.back();
		now=ask(a,b);if(lst)now.push_back(lst);
	}cerr<<now.size()<<"\n";
}
void sol2(){
	while(tot<7){a.clear(),b.clear(),tmp.clear(),to.clear();
    	shuffle(now.begin(),now.end(),R),tot++;
		for(int i=0;i+1<now.size();i++)a.push_back(now[i]),b.push_back(now[i+1]);
		a.push_back(now[0]),b.push_back(now.back()),tmp=ask(a,b);
		for(int i=0;i<now.size();i++){
			if(tmp[i?i-1:now.size()-1]==tmp[i]&&tmp[i]==now[i])to.push_back(now[i]);
		}now=to;
	}cerr<<now.size()<<"\n";
}
void sol3(){
	while(tot<8){a.clear(),b.clear(),tmp.clear(),to.clear();
    	shuffle(now.begin(),now.end(),R),tot++;
    	int len=10;len=max(len,2);
		vector<int>id(now.size());
    	for(int i=0;i<now.size();i++)id[i]=i/len+1;
    	for(int i=0;i<=id.back();i++){
    		int l=i*len,r=min(i*len+len,(int)now.size())-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]);
		}tmp=ask(a,b);int num=0;
		for(int i=0;i<=id.back();i++){cnt.clear();
    		int l=i*len,r=min(i*len+len,(int)now.size())-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;
	}cerr<<now.size()<<"\n";
}
int richest(int N,int T,int S){now.clear(),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);
	return sol1(),sol2(),sol3(),sol0(),now[0];
}

詳細信息


Pretests

Pretest #1:

score: 15
Accepted
time: 737ms
memory: 24436kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 38
Acceptable Answer
time: 3716ms
memory: 101524kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 38 / 85, maxt = 9, maxs = 1107984
3480857469986701605
0.447059
12486674425747334617

result:

points 0.447059 Partially correct Case 2, 38 / 85, maxt = 9, maxs = 1107984


Final Tests

Test #1:

score: 15
Accepted
time: 736ms
memory: 22464kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 38
Acceptable Answer
time: 3836ms
memory: 101368kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 38 / 85, maxt = 9, maxs = 1107392
6644931740818600743
0.447059
12486674425747334617

result:

points 0.447059 Partially correct Case 2, 38 / 85, maxt = 9, maxs = 1107392