QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#506783#9156. 百万富翁12345678hzxCompile Error//C++14885b2024-08-05 21:48:142024-08-05 21:48:14

Judging History

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

  • [2024-08-05 21:48:14]
  • 评测
  • [2024-08-05 21:48:14]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<vector>
#include<ctime>
#include<map>
#include<set>
#include<bitset>
#include<list>
#include "richest.h"

using namespace std;

int richest(int N,int T,int S) {
	int cnt=0;
	std::vector<int>t,a,b,Map;
	Map.resize(1000005);
	for(int i=0;i<N;i++) t.push_back(i);
	while(cnt<9) {
		if(N<=1000) break;
		a.clear(),b.clear();
		for(int i=1;i<=N/2;i++) a.push_back(t[i*2-2]),b.push_back(t[i*2-1]);
		int last=t.back();
		t=ask(a,b);
		if(N&1) t.push_back(last);
		N=(N+1)/2,cnt++;
	}
	a.clear(),b.clear();
	for(int i=1;i<=N;i++) for(int j=i+1;j<=N;j++) a.push_back(t[i-1]),b.push_back(t[j-1]);
	std::vector<int>T=ask(a,b);
	for(auto i:T) Map[i]++;
	for(auto i:t) if(Map[i]==N-1) return i;
}

Details

answer.code: In function ‘int richest(int, int, int)’:
answer.code:36:25: error: declaration of ‘std::vector<int> T’ shadows a parameter
   36 |         std::vector<int>T=ask(a,b);
      |                         ^
answer.code:20:23: note: ‘int T’ previously declared here
   20 | int richest(int N,int T,int S) {
      |                   ~~~~^
answer.code:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^