QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#502232#9156. 百万富翁maxrgby#Compile Error//C++14900b2024-08-03 01:33:432024-08-03 01:33:44

Judging History

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

  • [2024-08-03 01:33:44]
  • 评测
  • [2024-08-03 01:33:43]
  • 提交

answer

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

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();
	}
	vector<int> nums;
	for(int i = 0;i < n;i++){
		nums.push_back(i);
	}
	int sum = 0;
	while(t--){
		vector<int> arr[2];
		for(int i = 0;i < nums.size();i++){
			arr[i&1].push_back(nums[i]);
		}
		sum += arr[0].size();
		if(arr[0].size() != arr[1].size()){
			arr[1].push_back(nums[0]);
		}
		nums = ask(a,b);
	}
	assert(sum <= s);
	assert(nums.size() == 1);
    return *nums.begin();
}

详细

answer.code: In function ‘int richest(int, int, int)’:
answer.code:41:28: error: ‘a’ was not declared in this scope
   41 |                 nums = ask(a,b);
      |                            ^
answer.code:41:30: error: ‘b’ was not declared in this scope
   41 |                 nums = ask(a,b);
      |                              ^