QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#502369#9156. 百万富翁alexz1205#Compile Error//C++141.1kb2024-08-03 04:48:512024-08-03 04:48:53

Judging History

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

  • [2024-08-03 04:48:53]
  • 评测
  • [2024-08-03 04:48:51]
  • 提交

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;
		for (int x = 0; x < N; x ++){
			for (int y = x+1; y < N; y ++){
				a.push_back(x);
				b.push_back(y);
			}
		}
		vector<int> c = ask(a, b);
		int ma = 0;
		int check = 0, cur = 0;
		for (int x = 1; x < N; x ++){
			cur += N-x;
			if (c[check + x-ma-1] == x){
				ma = x;
				check = cur;
			}
		}
		return ma;
	}else {
		vector<int> rem;
		for (int x = 0; x < N; x ++){
			rem.push_back(x);
		}
		vector<int> a, b;
		for (int x = 0; x < 20; x ++){
			if (rem.size() == 1){
				break;
			}
			for (int i = 0; i < rem.size()/2; i ++){
				a.push_back(rem[2*i]);
				b.push_back(rem[2*i+1]);
			}
			c = ask(a, b);
			vector<int> nextRem;
			for (int i = 0; i < rem.size()/2; i ++){
				if (c[i] == rem[2*i]){
					nextRem.push_back(rem[2*i]);
				}else {
					nextRem.push_back(rem[2*i + 1]);
				}
			}
			if (rem.size() & 1){
				nextRem.push_back(rem.back());
			}
			swap(nextRem, rem);
		}
		return rem[0];
	}
	return 0;
}

Details

answer.code: In function ‘int richest(int, int, int)’:
answer.code:39:25: error: ‘c’ was not declared in this scope
   39 |                         c = ask(a, b);
      |                         ^