QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741572#9156. 百万富翁Skadi_H100 ✓2249ms104284kbC++141.4kb2024-11-13 14:40:092024-11-13 14:40:11

Judging History

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

  • [2024-11-13 14:40:11]
  • 评测
  • 测评结果:100
  • 用时:2249ms
  • 内存:104284kb
  • [2024-11-13 14:40:09]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
int len[8]={500000,250000,125000,62500,20833,3472,183,1};
bool vis[1000005];
vector<int>lft,a,b,res,lin;
int richest(int N,int T,int S){
	if(T==1){
		memset(vis,0,sizeof vis);
		vector<int>().swap(a);
		vector<int>().swap(b);
		for(int i=0;i<N;i++){
			for(int j=0;j<i;j++){
				a.push_back(i);
				b.push_back(j);
			}
		}
		res=ask(a,b);
		for(int i=0;i<a.size();i++){
			if(res[i]==a[i])
				vis[b[i]]=1;
			else
				vis[a[i]]=1;
		}
		for(int i=0;i<N;i++){
			if(!vis[i])
				return i;
		}
		return 1234567;
	}
	lft.resize(N);
	for(int i=0;i<=N;i++){
		lft[i]=i;
	}
	for(int o=0;o<8;o++){
		vector<int>().swap(a);
		vector<int>().swap(b);
		int q=N/len[o],r=N%len[o];
		int pos=0;
		for(int i=1;i<=len[o]-r;i++,pos+=q){
			for(int j=pos;j<pos+q;j++){
				for(int k=pos;k<j;k++){
					a.push_back(lft[j]);
					b.push_back(lft[k]);
				} 
			}
		}
		for(int i=1;i<=r;i++,pos+=q+1){
			for(int j=pos;j<pos+q+1;j++){
				for(int k=pos;k<j;k++){
					a.push_back(lft[j]);
					b.push_back(lft[k]);
				}
			}
		}
		res=ask(a,b);
		for(int i=0;i<a.size();i++){
			if(res[i]==a[i])
				vis[b[i]]=1;
			else
				vis[a[i]]=1;
		}
		for(int x:lft){
			if(!vis[x])
				lin.push_back(x);
		}
		lft=lin;
		vector<int>().swap(lin);
		N=lft.size();
		memset(vis,0,sizeof vis);
	}
	return lft[0];
}
//Skadi_H

詳細信息


Pretests

Pretest #1:

score: 15
Accepted
time: 630ms
memory: 25192kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2211ms
memory: 104284kb

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: 631ms
memory: 25588kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2249ms
memory: 83344kb

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