QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#502162#9156. 百万富翁maxrgby#0 0ms0kbC++141.3kb2024-08-03 01:16:132024-08-03 01:16:16

Judging History

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

  • [2024-08-03 01:16:16]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-08-03 01:16:13]
  • 提交

answer

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

// int arr[1000005];

// vector<int> ask(vector<int> a, vector<int> b){
// 	vector<int> ret;
// 	for(int i = 0;i < a.size();i++){
// 		if(arr[a[i]] > arr[b[i]]){
// 			ret.push_back(a[i]);
// 		}else{
// 			ret.push_back(b[i]);
// 		}
// 	}
// 	return ret;
// }

int richest(int n, int t, int s) {
	assert(t >= ceil(log2(n)));
	assert(s >= 2*n);
	set<int> nums;
	for(int i = 0;i < n;i++){
		nums.insert(i);
	}
	vector<int> a,b,c;
	int sum = 0;
	while(t--){
		a.clear();
		b.clear();
		c.clear();
		int i = 0;
		for(auto it = nums.begin();it != nums.end();it++,i++){
			if(i&1){
				b.push_back(*it);
			}else{
				a.push_back(*it);
			}
		}
		if(a.size() != b.size()){
			b.push_back({*nums.rbegin()});
		}
		sum += a.size();
		c = ask(a,b);
		nums.clear();
		for(auto i : c){
			nums.insert(i);
		}
		//cout << "sz=" << nums.size() << endl;
	}
	//cout << "sum=" << sum << endl;
	assert(nums.size() == 1);
    return *nums.begin();
}

// int main(){
// 	int n,t,s;
// 	cin >> n >> t >> s;
// 	int mx = 0;
// 	for(int i = 0;i < n;i++){
// 		cin >> arr[i];
// 		mx = max(mx,arr[i]);
// 	}
// 	//cout << "mx=" << mx << endl;
// 	//cout << "arr=" << arr[3073] << endl;
// 	cout << richest(n,t,s) << endl;
// }

詳細信息


Pretests

Pretest #1:

score: 0
Runtime Error

input:

1000 1 499500 957319859

output:

Unauthorized output

result:


Pretest #2:

score: 0
Time Limit Exceeded

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 11 / 85, maxt = 20, maxs = 1000007
2862133516934917577
0.129412
3823502568050958645

result:



Final Tests

Test #1:

score: 0
Runtime Error

input:

1000 1 499500 957319857

output:

Unauthorized output

result:


Test #2:

score: 0
Time Limit Exceeded

input:

1000000 20 2000000 29091471

output:

Unauthorized output

result: