QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#492488#9156. 百万富翁Erinyes#47.999975 5481ms99064kbC++141.6kb2024-07-26 12:46:562024-07-26 12:46:56

Judging History

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

  • [2024-07-26 12:46:56]
  • 评测
  • 测评结果:47.999975
  • 用时:5481ms
  • 内存:99064kb
  • [2024-07-26 12:46:56]
  • 提交

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;
// }
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,4,10,42,50};
	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);
	// int k=2;
	// while(ceil(log(n)/log(k+1))>T)k++;
	// int k=5,len=5;
	for(int t=0;t<7;t++){
		int k=len[t];
		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;}
			}
		}
		d=D;
	}
	return d.front();
}
// int main(){
// 	cout<<richest(1000000,10,2000000)<<endl;
// 	cout<<cnt<<' '<<sum<<endl;
// }

详细


Pretests

Pretest #1:

score: 15
Accepted
time: 614ms
memory: 31628kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 33
Acceptable Answer
time: 5481ms
memory: 99064kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 33 / 85, maxt = 7, maxs = 1262478
6933956173620870519
0.388235
17414401996115510873

result:

points 0.388235 Partially correct Case 2, 33 / 85, maxt = 7, maxs = 1262478


Final Tests

Test #1:

score: 15
Accepted
time: 622ms
memory: 32668kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 33
Acceptable Answer
time: 5438ms
memory: 98560kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 33 / 85, maxt = 7, maxs = 1262478
6933956173620870519
0.388235
17414401996115510873

result:

points 0.388235 Partially correct Case 2, 33 / 85, maxt = 7, maxs = 1262478