QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#509781#9156. 百万富翁jamjanek#15 614ms81196kbC++201.4kb2024-08-08 18:38:222024-08-08 18:38:22

Judging History

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

  • [2024-08-08 18:38:22]
  • 评测
  • 测评结果:15
  • 用时:614ms
  • 内存:81196kb
  • [2024-08-08 18:38:22]
  • 提交

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)){
		if(((long long)mozliwe.size()*((long long)mozliwe.size()-1)/2<=(long long)s+100000))break;
//		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();
	}
	while(((long long)mozliwe.size()*((long long)mozliwe.size()-1)/2>(long long)s))mozliwe.pop_back();
//	return mozliwe[0];
	return na_raz (mozliwe);
	
}

详细


Pretests

Pretest #1:

score: 15
Accepted
time: 597ms
memory: 26148kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Wrong Answer
time: 193ms
memory: 81196kb

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: 614ms
memory: 25416kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Wrong Answer
time: 192ms
memory: 81180kb

input:

1000000 20 2000000 29091471

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer