QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#489968#9156. 百万富翁SimonLJK100 ✓3054ms90424kbC++141.1kb2024-07-25 09:44:132024-07-25 09:44:14

Judging History

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

  • [2024-07-25 09:44:14]
  • 评测
  • 测评结果:100
  • 用时:3054ms
  • 内存:90424kb
  • [2024-07-25 09:44:13]
  • 提交

answer

#include"richest.h"
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+99;
int grp[10]={0,500000,250000,125000,62500,20833,3472,183,1};
int cnt[N];
int richest(int n,int T,int S){
	vector<int> ans;
	for(int i=0;i<n;i++)
		ans.push_back(i);
	if(T==1){
		vector<int> a,b,c;
    	for(int j=0;j<ans.size();j++)
			for(int k=j%1;k<j;k+=1)
				 a.push_back(ans[j]),b.push_back(ans[k]);
		c=ask(a,b);
		memset(cnt,0,sizeof(cnt));
		for(int j=0;j<c.size();j++)
			if(c[j]==a[j]) cnt[b[j]]++;
			else cnt[a[j]]++;
		vector<int> nid;
		for(int j=0;j<ans.size();j++)
			if(!cnt[ans[j]])
				nid.push_back(ans[j]);
		swap(nid,ans);
		return ans[0];
	}
    for(int i=1;i<=8;i++){
    	vector<int> a,b,c;
    	for(int j=0;j<ans.size();j++)
			for(int k=j%grp[i];k<j;k+=grp[i])
				 a.push_back(ans[j]),b.push_back(ans[k]);
		c=ask(a,b);
		memset(cnt,0,sizeof(cnt));
		for(int j=0;j<c.size();j++)
			if(c[j]==a[j]) cnt[b[j]]++;
			else cnt[a[j]]++;
		vector<int> nid;
		for(int j=0;j<ans.size();j++)
			if(!cnt[ans[j]])
				nid.push_back(ans[j]);
		swap(nid,ans);
	}
    return ans[0];
}

详细


Pretests

Pretest #1:

score: 15
Accepted
time: 635ms
memory: 25504kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 3031ms
memory: 90260kb

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: 633ms
memory: 26436kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 3054ms
memory: 90424kb

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