QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#492497#9156. 百万富翁Erinyes#81.999975 4787ms98876kbC++141.6kb2024-07-26 12:51:512024-07-26 12:51:52

Judging History

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

  • [2024-07-26 12:51:52]
  • 评测
  • 测评结果:81.999975
  • 用时:4787ms
  • 内存:98876kb
  • [2024-07-26 12:51:51]
  • 提交

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,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);
	// int k=2;
	// while(ceil(log(n)/log(k+1))>T)k++;
	// int k=5,len=5;
	for(int t=0;t<8;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: 610ms
memory: 33324kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 67
Acceptable Answer
time: 4769ms
memory: 98060kb

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: 621ms
memory: 32708kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 67
Acceptable Answer
time: 4787ms
memory: 98876kb

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