QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#489718#9156. 百万富翁wangjinbo81.999975 2515ms110108kbC++231.1kb2024-07-24 23:35:282024-07-24 23:35:28

Judging History

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

  • [2024-07-24 23:35:28]
  • 评测
  • 测评结果:81.999975
  • 用时:2515ms
  • 内存:110108kb
  • [2024-07-24 23:35:28]
  • 提交

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,183},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;
	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;
    		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: 597ms
memory: 31440kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 67
Acceptable Answer
time: 2282ms
memory: 105788kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960
2586970244946203279
0.788235
12006835993993373281

result:

points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960


Final Tests

Test #1:

score: 15
Accepted
time: 601ms
memory: 31560kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 67
Acceptable Answer
time: 2515ms
memory: 110108kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960
2586970244946203279
0.788235
12006835993993373281

result:

points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960