QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#502202#9156. 百万富翁maxrgby#26.00002 5651ms106708kbC++141.5kb2024-08-03 01:24:232024-08-03 01:24:28

Judging History

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

  • [2024-08-03 01:24:28]
  • 评测
  • 测评结果:26.00002
  • 用时:5651ms
  • 内存:106708kb
  • [2024-08-03 01:24:23]
  • 提交

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) {
	if(t == 1){
		vector<int> a,b,c;
		set<int> nums;
		for(int i = 0;i < n;i++){
			for(int j = i+1;j < n;j++){
				a.push_back(i);
				b.push_back(j);
			}
			nums.insert(i);
		}
		c = ask(a,b);
		for(int i = 0;i < c.size();i++){
			if(c[i] != a[i]){
				nums.erase(a[i]);
			}else{
				nums.erase(b[i]);
			}
		}
		assert(nums.size() == 1);
		return *nums.begin();
	}
	set<int> nums;
	for(int i = 0;i < n;i++){
		nums.insert(i);
	}
	while(t--){
		vector<int> a,b;
		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()});
		}
		vector<int> c = ask(a,b);
		nums.clear();
		for(auto i : c){
			nums.insert(i);
		}
	}
	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: 15
Accepted
time: 634ms
memory: 23724kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 11
Acceptable Answer
time: 5649ms
memory: 106464kb

input:

1000000 20 2000000 29091473

output:

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

result:

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


Final Tests

Test #1:

score: 15
Accepted
time: 635ms
memory: 21940kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 11
Acceptable Answer
time: 5651ms
memory: 106708kb

input:

1000000 20 2000000 29091471

output:

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

result:

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