QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#527192#9156. 百万富翁kymmykym#15 743ms25216kbC++14956b2024-08-22 11:46:202024-08-22 11:46:20

Judging History

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

  • [2024-08-22 11:46:20]
  • 评测
  • 测评结果:15
  • 用时:743ms
  • 内存:25216kb
  • [2024-08-22 11:46:20]
  • 提交

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);
}
int richest(int n, int T, int S){
	vector<int> vec;
	for(int i=0;i<n;i++){
		vec.push_back(i);
	}
	return do_all(vec);
	while(vec.size()>1){
		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 vec[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 740ms
memory: 23156kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Memory Limit Exceeded

input:

1000000 20 2000000 29091473

output:

Unauthorized output

result:



Final Tests

Test #1:

score: 15
Accepted
time: 743ms
memory: 25216kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Memory Limit Exceeded

input:

1000000 20 2000000 29091471

output:

Unauthorized output

result: