QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#500386#9156. 百万富翁Flamire#100 ✓2754ms83172kbC++201.4kb2024-08-01 10:52:062024-08-01 10:52:08

Judging History

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

  • [2024-08-01 10:52:08]
  • 评测
  • 测评结果:100
  • 用时:2754ms
  • 内存:83172kb
  • [2024-08-01 10:52:06]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
struct info{int x,y,k;};
bool ok[1000011];int n;
void askask(int x,int y,int k)
{//printf("askask(%d,%d,%d)\n",x,y,k);
	vector<int> a,b;
	static vector<int> vv;vv.clear();
	::n=n;
	for(int i=0;i<n;++i)if(ok[i])vv.push_back(i);
	// printf("vv:");for(int x:vv)printf("%d ",x);putchar(10);
	int pt=0;
	while(x--)
	{
		vector<int> aa;
		for(int _=0;_<k;++_)
		{
			aa.push_back(vv.back());vv.pop_back();
		}
		// printf("aa:");for(int x:aa)printf("%d ",x);putchar(10);
		for(int _=0;_<aa.size();++_)for(int __=_+1;__<aa.size();++__)a.push_back(aa[_]),b.push_back(aa[__]);
	}
	while(y--)
	{
		vector<int> aa;
		for(int _=0;_<k+1;++_)
		{
			aa.push_back(vv.back());vv.pop_back();
		}
		for(int _=0;_<aa.size();++_)for(int __=_+1;__<aa.size();++__)a.push_back(aa[_]),b.push_back(aa[__]);
	}
	auto c=ask(a,b);
	for(int i=0;i<a.size();++i)
	{
		ok[a[i]^b[i]^c[i]]=0;
	}
}
int richest(int n, int T, int S) {
	for(int i=0;i<n;++i)ok[i]=1;::n=n;
	if(T==1)askask(1,0,n);
	else
	{
		// {1,0,183}
		// {5,178,18}
		// {3472,0,6}
		// {20832,0,3}
		// {62488,8,2}
		// {125000,0,2}
		// {250000,0,2}
		// {500000,0,2}
		askask(500000,0,2);
		askask(250000,0,2);
		askask(125000,0,2);
		askask(62488,8,2);
		askask(20832,0,3);
		askask(3472,0,6);
		askask(5,178,18);
		askask(1,0,183);
	}
	for(int i=0;i<n;++i)if(ok[i])return i;
	return -1;
}

詳細信息


Pretests

Pretest #1:

score: 15
Accepted
time: 616ms
memory: 25340kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2740ms
memory: 83172kb

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: 604ms
memory: 25328kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2754ms
memory: 83084kb

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