QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#509736#9156. 百万富翁jamjanek#15 613ms79988kbC++201.1kb2024-08-08 18:03:362024-08-08 18:03:37

Judging History

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

  • [2024-08-08 18:03:37]
  • 评测
  • 测评结果:15
  • 用时:613ms
  • 内存:79988kb
  • [2024-08-08 18:03:36]
  • 提交

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<=s)){
//		printf("srodek %lld %d\n", (long long)mozliwe.size()*((long long)mozliwe.size()-1)/2, s);
		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 na_raz (mozliwe);
	
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 609ms
memory: 24040kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Wrong Answer
time: 222ms
memory: 79276kb

input:

1000000 20 2000000 29091473

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer


Final Tests

Test #1:

score: 15
Accepted
time: 613ms
memory: 25408kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Wrong Answer
time: 204ms
memory: 79988kb

input:

1000000 20 2000000 29091471

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer