QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#492405#9156. 百万富翁_FJqwq15 619ms104608kbC++141.4kb2024-07-26 11:59:312024-07-26 11:59:32

Judging History

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

  • [2024-07-26 11:59:32]
  • 评测
  • 测评结果:15
  • 用时:619ms
  • 内存:104608kb
  • [2024-07-26 11:59:31]
  • 提交

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;
	}
	for(int i=0;i<N;i++)
		now.push_back(i);
	len=N;
	return work(8);
}





详细


Pretests

Pretest #1:

score: 15
Accepted
time: 604ms
memory: 28224kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Wrong Answer
time: 413ms
memory: 104608kb

input:

1000000 20 2000000 29091473

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer


Final Tests

Test #1:

score: 15
Accepted
time: 619ms
memory: 26684kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Wrong Answer
time: 401ms
memory: 104428kb

input:

1000000 20 2000000 29091471

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer