QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#486971#9156. 百万富翁NOI_AK_ME0 0ms0kbC++17936b2024-07-22 14:23:432024-07-22 14:23:44

Judging History

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

  • [2024-07-22 14:23:44]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-07-22 14:23:43]
  • 提交

answer

#include <bits/stdc++.h>
#include "richest.h"
#define il inline
using namespace std;
il int sub1(int n,int tt,int ss,vector<int> a){
	int x,y,z,u,v,w,m=0;for(int i=0;i<n;++i) m=max(m,a[i]);
	vector<int> in(m,0),aska,askb,ret;
	for(int i=0;i<n;++i) for(int j=i+1;j<n;++j) aska.push_back(a[i]),askb.push_back(a[j]);
	ret=ask(aska,askb);x=ret.size();
	for(int i=0;i<x;++i) ++in[ret[i]];
	for(int i=0;i<n;++i) if(in[a[i]]==n-1) return a[i];
}
int richest(int n,int tt,int ss){
	int x,y,z,u,v,w,m=0;vector<int> a,b,vis(n,0),aska,askb,ret;
	for(int i=0;i<n;++i) a[i]=i;
	while(a.size()>1){
		m=a.size(),b.clear(),aska.clear(),askb.clear();
		if(m<=512) return sub1(m,tt,ss,a);
		for(int i=0;i<m-1;++i) aska.push_back(a[i]),askb.push_back(a[i+1]);
		ret=ask(aska,askb);
		for(int i=0;i<m-1;++i) if(ret[i]==aska[i]) vis[askb[i]]=1;else vis[aska[i]]=1;
		for(int i=0;i<m;++i) if(!vis[a[i]]) b.push_back(a[i]);
		a=b;
	}
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 0
Runtime Error

input:

1000 1 499500 957319859

output:


result:


Pretest #2:

score: 0
Runtime Error

input:

1000000 20 2000000 29091473

output:


result:



Final Tests

Test #1:

score: 0
Runtime Error

input:

1000 1 499500 957319857

output:


result:


Test #2:

score: 0
Runtime Error

input:

1000000 20 2000000 29091471

output:


result: