QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#492407#9156. 百万富翁_FJqwq100 ✓2164ms109400kbC++141.5kb2024-07-26 12:00:262024-07-26 12:00:26

Judging History

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

  • [2024-07-26 12:00:26]
  • 评测
  • 测评结果:100
  • 用时:2164ms
  • 内存:109400kb
  • [2024-07-26 12:00:26]
  • 提交

answer

#include"richest.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int M=1000005;
std::vector<int>a,b,c,now,qwq;
int cnt[M],l,len,g[M],ans;
int L[M],R[M],tot;
int p[10]={0,1,183,3472,20832,62496,125000,250000,500000};
int work(int k){
	if(k==0){
		if(now.size()!=1) puts("WTF");
		return now[0];
	}
	int nl=p[k],l1=len/nl,c1,c2=len%nl;
	c1=nl-c2;
	R[0]=-1;
	for(int i=1;i<=c1;i++){
		L[i]=R[i-1]+1;
		R[i]=L[i]+l1-1;
	}
	for(int i=c1+1;i<=nl;i++){
		L[i]=R[i-1]+1;
		R[i]=L[i]+l1;
	}
	a.clear();
	b.clear();
	for(int i=1;i<=nl;i++)
		for(int j=L[i];j<R[i];j++)
			for(int p=j+1;p<=R[i];p++){
				a.push_back(now[j]);
				b.push_back(now[p]);
			}
	c=ask(a,b);
	qwq.clear();
	l=c.size();
	for(int i=0;i<=1000000;i++) cnt[i]=0;
	for(int i=0;i<l;i++) cnt[c[i]]++;
	for(int i=1;i<=nl;i++){
		l=R[i]-L[i];
		for(int j=L[i];j<=R[i];j++)
			if(cnt[now[j]]==l){
				qwq.push_back(now[j]);
				break;
			}
	}
	now=qwq;
	len=now.size();
	return work(k-1);
}
int richest(int N,int T,int S){
	if(T==1){
		a.clear();
		b.clear();
		for(int i=0;i<N;i++)
			for(int j=i+1;j<N;j++){
				a.push_back(i);
				b.push_back(j);
			}
		c=ask(a,b);
		l=c.size();
		for(int i=0;i<N;i++) cnt[i]=0;
		for(int i=0;i<l;i++) cnt[c[i]]++;
		ans=-1;
		for(int i=0;i<N;i++)
			if(cnt[i]==N-1){
				ans=i;
				break;
			}
		return ans;
	}
	now.clear();
	for(int i=0;i<N;i++) now.push_back(i);
	len=N;
	return work(8);
}





Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 614ms
memory: 28380kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2119ms
memory: 109252kb

input:

1000000 20 2000000 29091473

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944


Final Tests

Test #1:

score: 15
Accepted
time: 626ms
memory: 26604kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2164ms
memory: 109400kb

input:

1000000 20 2000000 29091471

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944