QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#492393#9156. 百万富翁_FJqwq0 472ms104372kbC++141.4kb2024-07-26 11:54:072024-07-26 11:54:09

Judging History

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

  • [2024-07-26 11:54:09]
  • 评测
  • 测评结果:0
  • 用时:472ms
  • 内存:104372kb
  • [2024-07-26 11:54:07]
  • 提交

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);
		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);
}





Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 0
Wrong Answer
time: 67ms
memory: 32080kb

input:

1000 1 499500 957319859

output:

Too many total elements in queries
1469670942222006797
0.000000
6906350380861515327

result:

points 0.0 Too many total elements in queries

Pretest #2:

score: 0
Wrong Answer
time: 472ms
memory: 104304kb

input:

1000000 20 2000000 29091473

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer


Final Tests

Test #1:

score: 0
Wrong Answer
time: 62ms
memory: 32136kb

input:

1000 1 499500 957319857

output:

Too many total elements in queries
1469670942222006797
0.000000
6906350380861515327

result:

points 0.0 Too many total elements in queries

Test #2:

score: 0
Wrong Answer
time: 423ms
memory: 104372kb

input:

1000000 20 2000000 29091471

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer