QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#491833#9156. 百万富翁wangjinbo91.00003 2096ms94396kbC++231.7kb2024-07-25 23:05:212024-07-25 23:05:22

Judging History

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

  • [2024-07-25 23:05:22]
  • 评测
  • 测评结果:91.00003
  • 用时:2096ms
  • 内存:94396kb
  • [2024-07-25 23:05:21]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+10;
int w[10]={0,2,2,2,2,3,6,19,182},a[N],num,t[N];
void solve(int n,int o){
	//cout<<n<<" "<<o<<endl;
	memset(t,0,sizeof(t));
	int j=w[o];
	vector<int> v1,v2;
	if(5<=o&&o<=7){
		int r=n%j;
		for(int i=0,e=1;i<n;e++){
			
			//if(o==7)cout<<i<<" ";
			int l;if(e<=r)l=j+1;else l=j;
			for(int u=i;u<min(i+l,n);u++)
			for(int v=u+1;v<min(i+l,n);v++)
			v1.push_back(a[u]),v2.push_back(a[v]);
			i+=l;
		}
		//cout<<endl;
		vector<int> v=ask(v1,v2),rr;
		memset(t,0,sizeof(t));
		num=-1;
		for(int o:v)t[o]++;
		for(int i=0,e=1;i<n;e++){
			int l;if(e<=n%j)l=j+1;else l=j;
			for(int u=i;u<i+l;u++)if(t[a[u]]==l-1)rr.push_back(a[u]);
			i+=l;
		}
		for(int o:rr)a[++num]=o;
	}
	else{
		for(int i=0;i<n;){
			for(int u=i;u<min(i+j,n);u++)
			for(int v=u+1;v<min(i+j,n);v++)
			v1.push_back(a[u]),v2.push_back(a[v]);
			i+=j;
		}
		vector<int> v=ask(v1,v2),r;
		memset(t,0,sizeof(t));
		num=-1;
		for(int o:v)t[o]++;
		for(int i=0;i<n;i+=j){
			int w=min(j,n-i);
			for(int u=i;u<i+j;u++)if(t[a[u]]==w-1)r.push_back(a[u]);
		}
		for(int o:r)a[++num]=o;
	}
}

int richest(int N, int T, int S) {
	if(N==1000){
		memset(t,0,sizeof(t));
		vector<int> v1,v2;
		for(int i=0;i<N;i++)
		for(int j=i+1;j<N;j++)
		v1.push_back(i),v2.push_back(j);
		vector<int> v=ask(v1,v2);
		for(int o:v)t[o]++;
		for(int i=0;i<N;i++)if(t[i]==N-1)return i;
	}
    else{
    	int n=N;
    	for(int i=0;i<n;i++)a[i]=i;
    	for(int i=1;i<=8;i++){
    		solve(n,i);
    		int t=w[i];
    		int x=n/t,y=n%t;
    		if(5<=i&&i<=7)n=x;else n=x+(y>0);//cout<<n<<" "<<num<<endl;
		}
		//cout<<n<<endl;
		return a[0];
	}
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 616ms
memory: 31548kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 76
Acceptable Answer
time: 2096ms
memory: 94396kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947
708834003727782761
0.894118
11625001216319896173

result:

points 0.894118 Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947


Final Tests

Test #1:

score: 15
Accepted
time: 617ms
memory: 31556kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 76
Acceptable Answer
time: 2041ms
memory: 86736kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947
708834003727782761
0.894118
11625001216319896173

result:

points 0.894118 Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947