QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#509755#9156. 百万富翁jamjanek#51.99999 2068ms103512kbC++201.2kb2024-08-08 18:17:462024-08-08 18:17:48

Judging History

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

  • [2024-08-08 18:17:48]
  • 评测
  • 测评结果:51.99999
  • 用时:2068ms
  • 内存:103512kb
  • [2024-08-08 18:17:46]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;

int zlicz[1000010];
int na_raz(vector<int>X){
	if(X.size()==1)return X[0];
	vector<int>a,b;
	for(int i=0;i<(int)X.size();i++)
		for(int j=i+1;j<(int)X.size();j++){
			a.push_back(X[i]);
			b.push_back(X[j]);
		}
	vector<int>wynik = ask(a,b);
	for(auto j: wynik)zlicz[j]=0;
	for(auto j: wynik)zlicz[j]++;
	for(auto j: wynik)
		if(zlicz[j]==(int)X.size()-1)return j;
	return 0;
}

int richest(int n, int t, int s) {
	if(s==2000000)s=1099944;
	vector<int>mozliwe;
	int i;
	for(i=0;i<n;i++)mozliwe.push_back(i);
	while(!((long long)mozliwe.size()*((long long)mozliwe.size()-1)/2<=(long long)s)){
//		printf("srodek %lld %d\n", (long long)mozliwe.size()*((long long)mozliwe.size()-1)/2, s);
//	while(mozliwe.size()>1){
		vector<int>a,b;
		for(i=0;i<(int)mozliwe.size();i++){
			if(i%2==1)b.push_back(mozliwe[i]);
			if(i%2==0 && i!=(int)mozliwe.size()-1)a.push_back(mozliwe[i]);
		}
		if(!mozliwe.size()%2)
			mozliwe = ask(a,b);
		else{
			int pom = mozliwe.back();
			mozliwe = ask(a,b);
			mozliwe.push_back(pom);
		}
		s-=a.size();
	}
//	return mozliwe[0];
	return na_raz (mozliwe);
	
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 594ms
memory: 23976kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 37
Acceptable Answer
time: 2068ms
memory: 88020kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 37 / 85, maxt = 13, maxs = 1029895
4910259535189795073
0.435294
13281437197936769557

result:

points 0.435294 Partially correct Case 2, 37 / 85, maxt = 13, maxs = 1029895


Final Tests

Test #1:

score: 15
Accepted
time: 599ms
memory: 25332kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 37
Acceptable Answer
time: 2019ms
memory: 103512kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 37 / 85, maxt = 13, maxs = 1029895
4910259535189795073
0.435294
13281437197936769557

result:

points 0.435294 Partially correct Case 2, 37 / 85, maxt = 13, maxs = 1029895