QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#492440#9156. 百万富翁fqoi100 ✓2164ms107436kbC++141.1kb2024-07-26 12:22:522024-07-26 12:22:56

Judging History

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

  • [2024-07-26 12:22:56]
  • 评测
  • 测评结果:100
  • 用时:2164ms
  • 内存:107436kb
  • [2024-07-26 12:22:52]
  • 提交

answer

#include <bits/stdc++.h>
#include "richest.h"
using namespace std;
const int M=10,NN=1e6+114;
int cnt[NN],ans[M][NN],Q[M]={1000000,500000,250000,125000,62496,20832,3472,183,1};
int richest(int n,int T,int S){
	if(n==1000){
		memset(cnt,0,sizeof(int[1000]));
		vector<int> a,b;
		for(int i=0;i<n;++i){
			for(int j=i+1;j<n;++j){
				a.push_back(i);
				b.push_back(j);
			}
		}
		vector<int> c=ask(a,b);
		for(int k:c) ++cnt[k];
		return max_element(cnt,cnt+n)-cnt;
	}
	for(int i=0;i<n;++i) ans[0][i]=i;
	for(int i=1;i<=8;++i){
		vector<int> a,b;
		for(int j=0,k=0;j<Q[i];++j){
			int K=Q[i-1]/Q[i]+(j<Q[i-1]%Q[i]);
			for(int o1=k;o1<k+K;++o1){
				for(int o2=o1+1;o2<k+K;++o2){
					a.push_back(ans[i-1][o1]);
					b.push_back(ans[i-1][o2]);
				}
			}
			k+=K;
		}
		vector<int> c=ask(a,b);
		memset(cnt,0,sizeof(cnt));
		for(int k:c) ++cnt[k];
		for(int j=0,k=0;j<Q[i];++j){
			int K=Q[i-1]/Q[i]+(j<Q[i-1]%Q[i]);
			ans[i][j]=*max_element(ans[i-1]+k,ans[i-1]+k+K,[](int x,int y)->bool{return cnt[x]<cnt[y];});
			k+=K;
		}
	}
	return ans[8][0];
}

詳細信息


Pretests

Pretest #1:

score: 15
Accepted
time: 623ms
memory: 27420kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2151ms
memory: 105300kb

input:

1000000 20 2000000 29091473

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944


Final Tests

Test #1:

score: 15
Accepted
time: 619ms
memory: 27420kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2164ms
memory: 107436kb

input:

1000000 20 2000000 29091471

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944