QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#492256#9156. 百万富翁tuxuanming2024#26.00002 2330ms85320kbC++14941b2024-07-26 10:53:592024-07-26 10:54:00

Judging History

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

  • [2024-07-26 10:54:00]
  • 评测
  • 测评结果:26.00002
  • 用时:2330ms
  • 内存:85320kb
  • [2024-07-26 10:53:59]
  • 提交

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;
	}
	int tt=0;
	vector<int>p;
	for(int i=0;i<n;i++) p.push_back(i);
	while((int)p.size()>1)
	{
		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]);
		tt+=a.size();
		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;
		// for(auto x:p) cerr<<x<<" ";
		// cerr<<'\n';
	}
	return p[0];
}
/*
g++ grader.cpp richest.cpp -o richest -O2 -std=c++14 -static && ./richest
*/

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 607ms
memory: 29792kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 11
Acceptable Answer
time: 2330ms
memory: 85320kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999
1811468636458994965
0.129412
3823502568050958645

result:

points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999


Final Tests

Test #1:

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

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 11
Acceptable Answer
time: 2320ms
memory: 84576kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999
1811468636458994965
0.129412
3823502568050958645

result:

points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999