QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#492686#9156. 百万富翁Erinyes81.999975 4633ms104604kbC++141.7kb2024-07-26 15:16:412024-07-26 15:16:42

Judging History

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

  • [2024-07-26 15:16:42]
  • 评测
  • 测评结果:81.999975
  • 用时:4633ms
  • 内存:104604kb
  • [2024-07-26 15:16:41]
  • 提交

answer

#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
int id[1005][1005],ins[1000005];
map<pair<int,int>,int>g;
int cnt,sum;
// vector<int> ask(vector<int>a,vector<int>b){
// 	cnt++,sum+=a.size();
// 	vector<int>c;
// 	for(int i=0;i<a.size();i++){
// 		c.push_back(b[i]);
// 	}return c;
// }
inline vector<int> jqh(vector<int> d,int k){
	vector<int>A,B,C;g.clear();
	for(int i=0;i<d.size();i+=k){
		int r=min(i+k,(int)d.size());
		for(int a=i;a<r;a++){
			for(int b=a+1;b<r;b++){
				g[{a,b}]=A.size();
				A.push_back(d[a]),B.push_back(d[b]);
			}
		}
	}
	C=ask(A,B);
	vector<int>D;
	for(int i=0;i<d.size();i+=k){
		int r=min(i+k,(int)d.size());
		for(int a=i;a<r;a++){
			bool tag=1;
			for(int b=i;b<a;b++)if(C[g[{b,a}]]!=d[a]){tag=0;break;}
			for(int b=a+1;b<r;b++)if(C[g[{a,b}]]!=d[a]){tag=0;break;}
			if(tag){D.push_back(d[a]);break;}
		}
	}
	return D;
}
int richest(int n, int T, int S){
	// int len[9]={2,2,2,2,4,6,19,34,34};
	int len[8]={2,2,2,2,3,6,19,183};
	// int len[7]={2,2,3,3,7,20,199};
	if(n==1000){
		vector<int>A,B;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				id[i][j]=A.size(),A.push_back(i),B.push_back(j);
			}
		}
		auto C=ask(A,B);
		for(int i=0;i<n;i++){
			bool tag=1;
			for(int j=0;j<i;j++)if(C[id[j][i]]!=i)tag=0;
			for(int j=i+1;j<n;j++)if(C[id[i][j]]!=i)tag=0;
			if(tag)return i;
		}
	}
	vector<int>d;
	for(int i=0;i<n;i++)d.push_back(i);
	d=jqh(d,2);
	d=jqh(d,2);
	d=jqh(d,2);
	d=jqh(d,2);
	d=jqh(d,3);
	d=jqh(d,6);
	d=jqh(d,19);
	d=jqh(d,183);
	return d.front();
}
// int main(){
// 	cout<<richest(1000000,10,2000000)<<endl;
// 	cout<<cnt<<' '<<sum<<endl;
// }

详细


Pretests

Pretest #1:

score: 15
Accepted
time: 602ms
memory: 32624kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 67
Acceptable Answer
time: 4633ms
memory: 103672kb

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: 622ms
memory: 32364kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 67
Acceptable Answer
time: 4597ms
memory: 104604kb

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