QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#874529#9156. 百万富翁Mirasycle100 ✓2557ms98384kbC++141.3kb2025-01-28 10:27:522025-01-28 10:27:53

Judging History

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

  • [2025-01-28 10:27:53]
  • 评测
  • 测评结果:100
  • 用时:2557ms
  • 内存:98384kb
  • [2025-01-28 10:27:52]
  • 提交

answer

#include<bits/stdc++.h>
 #include "richest.h"
#define pb emplace_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int maxn=1e6+10;
typedef long long ll;
void chkmax(int &x,int y){ x=x>y?x:y; }
void chkmin(int &x,int y){ x=x<y?x:y; }
vector<int> ask(vector<int> a,vector<int> b);
int len[8]={500000,250000,125000,62500,20833,3472,183,1},vis[maxn];
vector<int> a,b,res,p;
void solve(vector<int> p){
	for(auto u:p)
		for(auto v:p){
			if(u>=v) continue;
			a.pb(u); b.pb(v);
		}
}
int richest(int N,int T,int S){
	p.clear(); for(int i=0;i<N;i++) p.pb(i);
	if(T==20){
		vector<int> tmp;
		for(int i=0;i<8;i++){
			tmp.clear(); a.clear(); b.clear();
			for(int j=0;j<p.size();j++)
				for(int k=j%len[i];k<j;k+=len[i]) a.pb(p[k]),b.pb(p[j]);
			res=ask(a,b);
			for(auto z:p) vis[z]=1;
			for(int i=0;i<a.size();i++)
				if(res[i]==a[i]) vis[b[i]]=0;
				else vis[a[i]]=0;
			for(auto z:p)
				if(vis[z]) tmp.pb(z),vis[z]=0;
			swap(p,tmp);
		}
		return p[0];
	}else{
		a.clear(); b.clear();
		solve(p); int ans;
		res=ask(a,b);
		for(auto z:p) vis[z]=1;
		for(int i=0;i<a.size();i++)
			if(res[i]==a[i]) vis[b[i]]=0;
			else vis[a[i]]=0;
		for(auto z:p)
			if(vis[z]) ans=z,vis[z]=0;;
		return ans;
	}
}

詳細信息


Pretests

Pretest #1:

score: 15
Accepted
time: 615ms
memory: 26712kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2557ms
memory: 98208kb

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: 617ms
memory: 26536kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2517ms
memory: 98384kb

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