QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#527196#9156. 百万富翁kymmykym#47.000035 2079ms99536kbC++14996b2024-08-22 11:49:402024-08-22 11:49:43

Judging History

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

  • [2024-08-22 11:49:43]
  • 评测
  • 测评结果:47.000035
  • 用时:2079ms
  • 内存:99536kb
  • [2024-08-22 11:49:40]
  • 提交

answer

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

typedef pair<int,int>pi;
int do_all(vector<int> vec){
	vector<int>A,B;
	for(int i=0;i<vec.size();i++){
		for(int j=i+1;j<vec.size();j++){
			A.push_back(vec[i]);
			B.push_back(vec[j]);
		}
	}
	vector<int>res=ask(A,B);
	map<int,int>cnt;
	int mx=0;
	for(auto x:res){
		cnt[x]++;
	}
	for(auto x:cnt)mx=max(mx,x.second);
	for(auto x:cnt){
		if(x.second==mx)return x.first;
	}
	assert(0);
}
const int LIM = 128;
int richest(int n, int T, int S){
	vector<int> vec;
	for(int i=0;i<n;i++){
		vec.push_back(i);
	}
	if(n==1000)return do_all(vec);
	while(vec.size()>LIM){
		vector<int> A, B;
		vector<int>nvec;
		for(int i=0;i<(int)vec.size()-1;i+=2){
			A.push_back(vec[i]);
			B.push_back(vec[i+1]);
		}
		if((int)vec.size() % 2 == 1){
			nvec.push_back(vec.back());//bye
		}
		vector<int>res=ask(A,B);
		for(auto x:res){
			nvec.push_back(x);
		}
		vec=nvec;
	}
	return do_all(vec);
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 751ms
memory: 23240kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 32
Acceptable Answer
time: 2079ms
memory: 99528kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 32 / 85, maxt = 14, maxs = 1007380
1918061652399545483
0.376471
10835644069095093111

result:

points 0.376471 Partially correct Case 2, 32 / 85, maxt = 14, maxs = 1007380


Final Tests

Test #1:

score: 15
Accepted
time: 771ms
memory: 25292kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 32
Acceptable Answer
time: 2069ms
memory: 99536kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 32 / 85, maxt = 14, maxs = 1007380
1918061652399545483
0.376471
10835644069095093111

result:

points 0.376471 Partially correct Case 2, 32 / 85, maxt = 14, maxs = 1007380