QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#492320#9156. 百万富翁tuxuanming2024#43.00002 2274ms77444kbC++141.3kb2024-07-26 11:23:082024-07-26 11:23:09

Judging History

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

  • [2024-07-26 11:23:09]
  • 评测
  • 测评结果:43.00002
  • 用时:2274ms
  • 内存:77444kb
  • [2024-07-26 11:23:08]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
int mx[1005][1005];
int richest(int n, int T, int S)
{
	if(T==1)
	{
		vector<int>a,b;
		for(int i=0;i<n;i++)
			for(int j=i+1;j<n;j++) a.push_back(i),b.push_back(j);
		vector<int>c=ask(a,b);
		for(int i=0,k=0;i<n;i++)
			for(int j=i+1;j<n;j++) mx[i][j]=c[k++];
		int ans=0;
		for(int i=1;i<n;i++) if(mx[ans][i]==i) ans=i;
		return ans;
	}
	vector<int>p;
	for(int i=0;i<n;i++) p.push_back(i);
	int tt=5;
	while(tt--)
	{
		int sz=p.size();
		vector<int>a,b;
		for(int i=0;i<sz;i+=2)
			if(i+1<sz) a.push_back(p[i]),b.push_back(p[i+1]);
		vector<int>c=ask(a,b),q;
		for(int i=0,j=0;i<sz;i+=2)
			if(i+1<sz) q.push_back(c[j++]);
			else q.push_back(p[i]);
		p=q;
	}
	while((int)p.size()>1)
	{
		int sz=p.size();
		vector<int>a,b;
		map<pair<int,int>,int>mx;
		for(int i=0;i<sz;i+=3)
		{
			for(int j=i;j<min(n,i+3);j++)
				for(int k=j+1;k<min(n,i+3);k++) a.push_back(p[j]),b.push_back(p[k]);
		}
		vector<int>c=ask(a,b),q;
		for(int i=0;i<(int)a.size();i++) mx[{a[i],b[i]}]=mx[{b[i],a[i]}]=c[i];
		for(int i=0;i<sz;i+=3)
		{
			int res=p[i];
			for(int j=i+1;j<min(n,i+3);j++)
				if(mx[{res,p[j]}]==p[j]) res=p[j];
			q.push_back(res);
		}
		p=q;
	}
	return p[0];
}
/*
g++ grader.cpp richest.cpp -o richest -O2 -std=c++14 -static && ./richest
*/

详细


Pretests

Pretest #1:

score: 15
Accepted
time: 624ms
memory: 29344kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 28
Acceptable Answer
time: 2274ms
memory: 77444kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 28 / 85, maxt = 15, maxs = 1015637
4284092099209020447
0.329412
5031514366929718649

result:

points 0.329412 Partially correct Case 2, 28 / 85, maxt = 15, maxs = 1015637


Final Tests

Test #1:

score: 15
Accepted
time: 615ms
memory: 29568kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 28
Acceptable Answer
time: 2209ms
memory: 76892kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 28 / 85, maxt = 15, maxs = 1015637
4284092099209020447
0.329412
5031514366929718649

result:

points 0.329412 Partially correct Case 2, 28 / 85, maxt = 15, maxs = 1015637