QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#492397#9156. 百万富翁_FJqwq0 385ms104540kbC++141.4kb2024-07-26 11:55:002024-07-26 11:55:01

Judging History

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

  • [2024-07-26 11:55:01]
  • 评测
  • 测评结果:0
  • 用时:385ms
  • 内存:104540kb
  • [2024-07-26 11:55:00]
  • 提交

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){
		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);
		while(1);
		l=c.size();
		for(int i=0;i<l;i++) cnt[c[i]]++;
		ans=-1;
		for(int i=0;i<l;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: 0
Time Limit Exceeded

input:

1000 1 499500 957319859

output:

Unauthorized output

result:


Pretest #2:

score: 0
Wrong Answer
time: 385ms
memory: 104352kb

input:

1000000 20 2000000 29091473

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer


Final Tests

Test #1:

score: 0
Time Limit Exceeded

input:

1000 1 499500 957319857

output:

Unauthorized output

result:


Test #2:

score: 0
Wrong Answer
time: 347ms
memory: 104540kb

input:

1000000 20 2000000 29091471

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer